日期:2014-05-17  浏览次数:20874 次

请教一个绘制多图zedGraph的问题
我在绘制一个多图的zedGraph的时候 无法控制其中的的 GraphPane的高度和宽度,老是会出现 图的纵坐标显示不全,各个图的大小不好控制的情况。
我现在想显示3个曲线图在一个控件上。前两个图的大小太大,最后一个图的大小又太小,求教各位啦。
C# code

private void Form1_Load(object sender, EventArgs e)
        {
            MasterPane master = zedGraphControl1.MasterPane;
            master.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45.0f);
            master.PaneList.Clear();
            master.Title.IsVisible = true;
            master.Title.Text = "感光电压曲线图";
            master.Margin.All = 10;
            master.InnerPaneGap = 0;
            ColorSymbolRotator rotator = new ColorSymbolRotator();
            for (int j = 0; j < 3; j++)
            {
                GraphPane myPaneT = new GraphPane(new Rectangle(40, 40, 500, 250),
                    "Case #" + (j+1).ToString(),
                    "时间",
                    "电压");
                myPaneT.Fill.IsVisible = false;
                myPaneT.Chart.Fill = new Fill(Color.White, Color.LightYellow, 45.0F);
                myPaneT.BaseDimension = 2.0F;
                myPaneT.XAxis.Title.IsVisible = false;
                myPaneT.XAxis.Scale.IsVisible = false;
                myPaneT.Legend.IsVisible = false;
                myPaneT.Border.IsVisible = false;
                myPaneT.Title.IsVisible = false;
                myPaneT.XAxis.MajorTic.IsOutside = false;
                myPaneT.XAxis.MinorTic.IsOutside = false;
                myPaneT.XAxis.MajorGrid.IsVisible = true;
                myPaneT.XAxis.MinorGrid.IsVisible = true;
                myPaneT.XAxis.Scale.Max = 50;
                myPaneT.XAxis.Scale.Min = 0;
                myPaneT.Margin.All = 0;
                LineItem myCurve = null;
                if (j == 0) 
                {
                    myPaneT.YAxis.Scale.MinorStep = 0.1;
                    myPaneT.YAxis.Scale.MajorStep = 1;
                    myPaneT.YAxis.Scale.Max = 5;
                    myPaneT.YAxis.Scale.Min = 0;
                    myPaneT.Margin.Top =0;
                    myPaneT.YAxis.Title.Text = "I1";
                    myCurve = myPaneT.AddCurve("Step " + j.ToString(), listI1, rotator.NextColor, SymbolType.None);
                    myCurve.Line.StepType = StepType.ForwardStep;
                    myCurve.Symbol.Fill = new Fill(Color.Red);
                    master.Add(myPaneT);
                    this.zedGraphControl1.AxisChange();
                }
                if(j==1)
                {
                    myPaneT.YAxis.Scale.MinorStep = 0.1;
                    myPaneT.YAxis.Scale.MajorStep = 1;
                    myPaneT.YAxis.Scale.Max = 5;
                    myPaneT.YAxis.Scale.Min = 0;
                    myPaneT.XAxis.Scale.MinorStep = 1;
                    myPaneT.Margin.Top = 0;
                    myPaneT.YAxis.Title.Text = "I2";
                    myCurve = myPaneT.AddCurve("Step " + j.ToString(), listI2, rotator.NextColor, SymbolType.None);
                    myCurve.Symbol.Fill = new Fill(Color.Red);
                    master.Add(myPaneT);
                    this.zedGraphControl1.AxisChange();
                }
                if (j == 2)
                {
                    //myPaneT.YAxis.Scale.Max = files.ReadInteger("SYSTEM", "DISPLAY_VOLTAGE2", 5);
                    //myPaneT.YAxis.Scale.Min = files.ReadInteger("SYSTEM", "DISPLAY_VOLTAGE1", -5); 
                    myPaneT.XAxis.Title.IsVisible = true;
                    myPaneT.XAxis.Scale.IsVisible = true;
                    myPaneT.XAxis.Scale.MinorStep = 1;
                    myPaneT.Margin.Top =0;
                    myPaneT.YAxis.Title.Text = "I3";
                    myCurve = myPaneT.AddCurve("Step " + j.ToString(), list, ro