Ejemplo n.º 1
0
        void initGC()
        {
            GC.IsEnableHPan  = true;
            GC.IsEnableVPan  = true;
            GC.IsEnableVZoom = false;

            GC.GraphPane.XAxis.IsVisible  = true;
            GC.GraphPane.X2Axis.IsVisible = false;
            GC.GraphPane.Y2Axis.IsVisible = true;



            SetXAxis(GC.GraphPane.XAxis);
            SetYAxis(GC.GraphPane.YAxis);
            SetYAxis(GC.GraphPane.Y2Axis);

            GC.GraphPane.YAxis.Title.Text  = "温度";
            GC.GraphPane.Y2Axis.Title.Text = "湿度";


            var yA = GC.GraphPane.YAxis;

            yA.Scale.Max = 50;
            yA.Scale.Min = 0;
            yA.Type      = ZedGraph.AxisType.Linear;


            CurveItem c = GC.GraphPane.AddCurve("T1", LTopTemp, Color.Blue, SymbolType.None);

            c = GC.GraphPane.AddCurve("T2", LBMTTemp, Color.YellowGreen, SymbolType.None);

            c          = GC.GraphPane.AddCurve("H1", LTopHR, Color.MediumVioletRed, SymbolType.None);
            c.IsY2Axis = true;
            c          = GC.GraphPane.AddCurve("H2", LBMTHR, Color.BlueViolet, SymbolType.None);
            c.IsY2Axis = true;

            GC.GraphPane.Title.IsVisible      = false;
            GC.GraphPane.Legend.IsVisible     = true;
            GC.GraphPane.Legend.FontSpec.Size = 8;
            GC.AxisChange();
            GC.Refresh();
        }
Ejemplo n.º 2
0
        void SetGraph2()
        {
            var g1 = GC.GraphPane;
            var g2 = new GraphPane();

            GC.MasterPane.Add(g2);

            GC.PointValueFormat  = "0.0";
            GC.IsShowPointValues = true;

            g1.Rect = new RectangleF(0, 0, GC.Width, GC.Height / 2);
            g2.Rect = new RectangleF(0, GC.Height / 2, GC.Width, GC.Height / 2);

            GC.IsEnableHPan  = true;
            GC.IsEnableVPan  = true;
            GC.IsEnableVZoom = false;

            g1.XAxis.IsVisible  = true;
            g1.X2Axis.IsVisible = false;
            g1.Y2Axis.IsVisible = false;

            g2.XAxis.IsVisible  = true;
            g2.X2Axis.IsVisible = false;
            g2.Y2Axis.IsVisible = false;

            g1.IsFontsScaled = false;
            g2.IsFontsScaled = false;



            SetXAxis(g1.XAxis);
            SetYAxis(g1.YAxis);
            SetYAxis(g1.Y2Axis);

            SetXAxis(g2.XAxis);
            SetYAxis(g2.YAxis);
            SetYAxis(g2.Y2Axis);

            g1.YAxis.Title.Text = "温度";
            g2.YAxis.Title.Text = "湿度";

            var yA = g1.YAxis;

            yA.Scale.Max = 50;
            yA.Scale.Min = 0;
            yA.Type      = ZedGraph.AxisType.Linear;

            var y2A = g1.Y2Axis;

            y2A.Scale.Max = 50;
            y2A.Scale.Min = 0;
            y2A.Type      = ZedGraph.AxisType.Linear;

            CurveItem c = g1.AddCurve("温度上", LTopTemp, Color.Blue, SymbolType.None);

            c = g1.AddCurve("温度下", LBMTTemp, Color.YellowGreen, SymbolType.None);
            c = g1.AddCurve("温度", new PointPairList(date, TempAVG), Color.DarkRed, SymbolType.None);

            c = g2.AddCurve("湿度上", LTopHR, Color.MediumVioletRed, SymbolType.None);

            // c.IsY2Axis = true;
            c = g2.AddCurve("湿度下", LBMTHR, Color.BlueViolet, SymbolType.None);
            c = g2.AddCurve("湿度", new PointPairList(date, HRAVG), Color.Blue, SymbolType.None);

            // c.IsY2Axis = true;

            g1.Title.IsVisible      = false;
            g1.Legend.IsVisible     = true;
            g1.Legend.FontSpec.Size = 10;

            g2.Title.IsVisible      = false;
            g2.Legend.IsVisible     = true;
            g2.Legend.FontSpec.Size = 10;


            SetScalFormat(g1.XAxis, g1);
            SetScalFormat(g2.XAxis, g2);

            SetGrid(g1);
            SetGrid(g2);

            GC.AxisChange();
            if (checkBox1.Checked)
            {
                GC.MasterPane[0].CurveList["温度"].IsVisible = true;
                GC.MasterPane[1].CurveList["湿度"].IsVisible = true;
            }
            else
            {
                GC.MasterPane[0].CurveList["温度"].IsVisible = false;
                GC.MasterPane[1].CurveList["湿度"].IsVisible = false;
            }
            GC.Refresh();
        }