Пример #1
0
        public PlotSinc()
        {
            infoText  = "";
            infoText += "Sinc Function Example. Demonstrates - \n";
            infoText += " * Charting line and point plot at the same time. \n";
            infoText += " * Adding a legend.";

            plotSurface.Clear();             // clear everything. reset fonts. remove plot components etc.

            System.Random r    = new Random();
            double[]      a    = new double[100];
            double[]      b    = new double[100];
            double        mult = 0.00001f;

            for (int i = 0; i < 100; ++i)
            {
                a[i] = ((double)r.Next(1000) / 5000.0f - 0.1f) * mult;
                if (i == 50)
                {
                    b[i] = 1.0f * mult;
                }
                else
                {
                    b[i]  = (double)Math.Sin((((double)i - 50.0f) / 4.0f)) / (((double)i - 50.0f) / 4.0f);
                    b[i] *= mult;
                }
                a[i] += b[i];
            }

            Marker    m  = new Marker(Marker.MarkerType.Cross1, 6, new Pen(Color.Blue, 2.0F));
            PointPlot pp = new PointPlot(m);

            pp.OrdinateData = a;
            pp.AbscissaData = new StartStep(-500.0, 10.0);
            pp.Label        = "Random";
            plotSurface.Add(pp);

            LinePlot lp = new LinePlot();

            lp.OrdinateData = b;
            lp.AbscissaData = new StartStep(-500.0, 10.0);
            lp.Pen          = new Pen(Color.Red, 2.0f);
            plotSurface.Add(lp);

            plotSurface.Title        = "Sinc Function";
            plotSurface.YAxis1.Label = "Magnitude";
            plotSurface.XAxis1.Label = "Position";

            Legend legend = new Legend();

            legend.AttachTo(XAxisPosition.Top, YAxisPosition.Left);
            legend.VerticalEdgePlacement   = Legend.Placement.Inside;
            legend.HorizontalEdgePlacement = Legend.Placement.Inside;
            legend.YOffset = 8;

            plotSurface.Legend       = legend;
            plotSurface.LegendZOrder = 1;             // default zorder for adding idrawables is 0, so this puts legend on top.

            plotSurface.Refresh();
        }
Пример #2
0
        public void RefreshPlots(NPlot.Windows.PlotSurface2D graphSurface)
        {
            graphSurface.Clear();

            if (_plots.Count == 0)
            {
                graphSurface.Hide();
                return;
            }


            foreach (var plot in _plots)
            {
                var lp = new LinePlot
                {
                    Color        = plot.PlotColour,
                    AbscissaData = plot.XData,
                    OrdinateData = plot.YData,
                    Label        = plot.PlotName
                };
                graphSurface.Add(lp);
            }

            graphSurface.Title = "Pilot Trends";
            var grid = new Grid
            {
                VerticalGridType   = Grid.GridType.Fine,
                HorizontalGridType = Grid.GridType.Fine,
                MajorGridPen       = new Pen(Color.LightGray, 0.5f)
            };

            graphSurface.Add(grid);

            graphSurface.Refresh();


            var leg = new Legend
            {
                HorizontalEdgePlacement = Legend.Placement.Inside,
                VerticalEdgePlacement   = Legend.Placement.Outside,
                XOffset = 10,
                YOffset = 10
            };

            leg.AttachTo(PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Right);

            graphSurface.Legend       = leg;
            graphSurface.LegendZOrder = 10;

            graphSurface.YAxis1.WorldMin  = 0;
            graphSurface.XAxis1.Label     = "Tour Number";
            graphSurface.XAxis1.WorldMin -= 1;
            graphSurface.XAxis1.WorldMax += 1;

            graphSurface.Show();
            graphSurface.Refresh();
        }
Пример #3
0
        private void AttachLegend(NPlot.Windows.PlotSurface2D surf)
        {
            Legend leg = new Legend();

            leg.AttachTo(PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Right);
            leg.HorizontalEdgePlacement = Legend.Placement.Inside;
            leg.VerticalEdgePlacement   = Legend.Placement.Outside;
            leg.XOffset       = 10;
            leg.YOffset       = 10;
            surf.Legend       = leg;
            surf.LegendZOrder = 10;
        }
Пример #4
0
        public PlotMarkerSample() : base()
        {
            infoText  = "";
            infoText += "Markers Example. Demonstrates - \n";
            infoText += " * PointPlot and the available marker types \n";
            infoText += " * Legends, and how to place them.";

            plotCanvas.Clear();

            double[] y = new double[1] {
                1.0
            };
            foreach (object i in Enum.GetValues(typeof(Marker.MarkerType)))
            {
                Marker m = new Marker((Marker.MarkerType)Enum.Parse(typeof(Marker.MarkerType), i.ToString()), 8);
                m.FillColor = Colors.Red;
                double[] x = new double[1];
                x[0] = (double)m.Type;
                PointPlot pp = new PointPlot();
                pp.OrdinateData = y;
                pp.AbscissaData = x;
                pp.Marker       = m;
                pp.Label        = m.Type.ToString();
                plotCanvas.Add(pp);
            }
            plotCanvas.Title            = "Markers";
            plotCanvas.YAxis1.Label     = "Index";
            plotCanvas.XAxis1.Label     = "Marker";
            plotCanvas.YAxis1.WorldMin  = 0.0;
            plotCanvas.YAxis1.WorldMax  = 2.0;
            plotCanvas.XAxis1.WorldMin -= 1.0;
            plotCanvas.XAxis1.WorldMax += 1.0;

            Legend legend = new Legend();

            legend.AttachTo(XAxisPosition.Top, YAxisPosition.Right);
            legend.VerticalEdgePlacement   = Legend.Placement.Outside;
            legend.HorizontalEdgePlacement = Legend.Placement.Inside;
            legend.XOffset    = 5;          // note that these numbers can be negative.
            legend.YOffset    = 0;
            plotCanvas.Legend = legend;

            PackStart(plotCanvas.Canvas, true);
            Label la = new Label(infoText);

            PackStart(la);
        }
 private void UpdateLegend()
 {
     if (plotSurface.Legend == null && lineTable.Count > 0)
     {
         Legend legend = new Legend();
         legend.AttachTo(NPlot.PlotSurface2D.XAxisPosition.Top, NPlot.PlotSurface2D.YAxisPosition.Right);
         legend.VerticalEdgePlacement   = Legend.Placement.Outside;
         legend.HorizontalEdgePlacement = Legend.Placement.Inside;
         legend.XOffset     = 5;
         legend.YOffset     = 0;
         plotSurface.Legend = legend;
         return;
     }
     if (plotSurface.Legend != null && lineTable.Count == 0)
     {
         plotSurface.Legend = null;
     }
 }
Пример #6
0
        public void CreatePlot(InteractivePlotSurface2D plotSurface)
        {
            plotSurface.Clear();

            double[] y = new double[1] {
                1.0f
            };
            foreach (object i in Enum.GetValues(typeof(Marker.MarkerType)))
            {
                Marker   m = new Marker((Marker.MarkerType)Enum.Parse(typeof(Marker.MarkerType), i.ToString()), 8);
                double[] x = new double[1];
                x[0] = (double)m.Type;
                PointPlot pp = new PointPlot();
                pp.OrdinateData = y;
                pp.AbscissaData = x;
                pp.Marker       = m;
                pp.Label        = m.Type.ToString();
                plotSurface.Add(pp);
            }
            plotSurface.Title            = "Markers";
            plotSurface.YAxis1.Label     = "Index";
            plotSurface.XAxis1.Label     = "Marker";
            plotSurface.YAxis1.WorldMin  = 0.0f;
            plotSurface.YAxis1.WorldMax  = 2.0f;
            plotSurface.XAxis1.WorldMin -= 1.0f;
            plotSurface.XAxis1.WorldMax += 1.0f;

            Legend legend = new Legend();

            legend.AttachTo(PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Right);
            legend.VerticalEdgePlacement   = Legend.Placement.Outside;
            legend.HorizontalEdgePlacement = Legend.Placement.Inside;
            legend.XOffset     = 5; // note that these numbers can be negative.
            legend.YOffset     = 0;
            plotSurface.Legend = legend;

            plotSurface.Refresh();
        }
Пример #7
0
        public PlotMockup()
        {
            infoText  = "";
            infoText += "THE TEST (can your charting library handle this?) - \n";
            infoText += "NPlot demonstrates it can handle real world charting requirements.";

            // first of all, generate some mockup data.
            DataTable info = new DataTable("Store Information");

            info.Columns.Add("Index", typeof(int));
            info.Columns.Add("IndexOffsetLeft", typeof(float));
            info.Columns.Add("IndexOffsetRight", typeof(float));
            info.Columns.Add("StoreName", typeof(string));
            info.Columns.Add("BarBase", typeof(float));
            info.Columns.Add("StoreGrowth", typeof(float));
            info.Columns.Add("AverageGrowth", typeof(float));
            info.Columns.Add("ProjectedSales", typeof(float));

            float  barBase = 185.0f;
            Random r       = new Random();

            for (int i = 0; i < 18; ++i)
            {
                DataRow row = info.NewRow();
                row["Index"]            = i;
                row["IndexOffsetLeft"]  = (float)i - 0.1f;
                row["IndexOffsetRight"] = (float)i + 0.1f;
                row["StoreName"]        = "Store " + (i + 1).ToString();
                row["BarBase"]          = barBase;
                row["StoreGrowth"]      = barBase + ((r.NextDouble() - 0.1) * 20.0f);
                row["AverageGrowth"]    = barBase + ((r.NextDouble() - 0.1) * 15.0f);
                row["ProjectedSales"]   = barBase + (r.NextDouble() * 15.0f);
                info.Rows.Add(row);
                barBase += (float)r.NextDouble() * 4.0f;
            }

            plotSurface.Clear();

            plotSurface.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            // generate the grid
            Grid grid = new Grid();

            grid.VerticalGridType   = Grid.GridType.Coarse;
            grid.HorizontalGridType = Grid.GridType.None;
            grid.MajorGridPen       = new Pen(Color.Black, 1.0f);
            plotSurface.Add(grid);

            // generate the trendline
            LinePlot trendline = new LinePlot();

            trendline.DataSource   = info;
            trendline.AbscissaData = "Index";
            trendline.OrdinateData = "BarBase";
            trendline.Pen          = new Pen(Color.Black, 3.0f);
            trendline.Label        = "Trendline";
            plotSurface.Add(trendline);

            // draw store growth bars
            BarPlot storeGrowth = new BarPlot();

            storeGrowth.DataSource         = info;
            storeGrowth.AbscissaData       = "IndexOffsetLeft";
            storeGrowth.OrdinateDataTop    = "StoreGrowth";
            storeGrowth.OrdinateDataBottom = "BarBase";
            storeGrowth.Label     = "Store Growth";
            storeGrowth.FillBrush = NPlot.RectangleBrushes.Solid.Black;
            //storeGrowth.BorderPen = new Pen( Color.Black, 2.0f );
            plotSurface.Add(storeGrowth);

            // draw average growth bars
            BarPlot averageGrowth = new BarPlot();

            averageGrowth.DataSource         = info;
            averageGrowth.AbscissaData       = "IndexOffsetRight";
            averageGrowth.OrdinateDataBottom = "BarBase";
            averageGrowth.OrdinateDataTop    = "AverageGrowth";
            averageGrowth.Label     = "Average Growth";
            averageGrowth.FillBrush = NPlot.RectangleBrushes.Solid.Gray;
            //averageGrowth.BorderPen = new Pen( Color.Black, 2.0f );
            plotSurface.Add(averageGrowth);

            // generate the projected sales step line.
            StepPlot projected = new StepPlot();

            projected.DataSource           = info;
            projected.AbscissaData         = "Index";
            projected.OrdinateData         = "ProjectedSales";
            projected.Pen                  = new Pen(Color.Orange, 3.0f);
            projected.HideVerticalSegments = true;
            projected.Center               = true;
            projected.Label                = "Projected Sales";
            projected.WidthScale           = 0.7f;
            plotSurface.Add(projected);

            // generate the minimum target line.
            HorizontalLine minimumTargetLine = new HorizontalLine(218, new Pen(Color.Green, 3.5f));

            minimumTargetLine.Label        = "Minimum Target";
            minimumTargetLine.LengthScale  = 0.98f;
            minimumTargetLine.ShowInLegend = true;             // off by default for lines.
            plotSurface.Add(minimumTargetLine);

            // generate the preferred target line.
            HorizontalLine preferredTargetLine = new HorizontalLine(228, new Pen(Color.Blue, 3.5f));

            preferredTargetLine.Label        = "Preferred Target";
            preferredTargetLine.LengthScale  = 0.98f;
            preferredTargetLine.ShowInLegend = true;             // off by default for lines.
            plotSurface.Add(preferredTargetLine);

            // make some modifications so that chart matches requirements.
            // y axis.
            plotSurface.YAxis1.TicksIndependentOfPhysicalExtent = true;
            plotSurface.YAxis1.TickTextNextToAxis = false;
            //plotSurface.YAxis1.TicksAngle = 3.0f * (float)Math.PI / 2.0f; // Not required if TicksAngle bug #2000693 fixed
            ((LinearAxis)plotSurface.YAxis1).LargeTickStep      = 10.0;
            ((LinearAxis)plotSurface.YAxis1).NumberOfSmallTicks = 0;

            // x axis
            plotSurface.XAxis1.TicksIndependentOfPhysicalExtent = true;
            plotSurface.XAxis1.TickTextNextToAxis = false;
            //plotSurface.XAxis1.TicksAngle = (float)Math.PI / 2.0f; // Not required if TicksAngle bug #2000693 fixed
            LabelAxis la = new LabelAxis(plotSurface.XAxis1);

            for (int i = 0; i < info.Rows.Count; ++i)
            {
                la.AddLabel((string)info.Rows[i]["StoreName"], Convert.ToInt32(info.Rows[i]["Index"]));
            }
            la.TicksLabelAngle  = (float)90.0f;
            la.TicksBetweenText = true;
            plotSurface.XAxis1  = la;

            plotSurface.XAxis2 = (Axis)plotSurface.XAxis1.Clone();
            plotSurface.XAxis2.HideTickText  = true;
            plotSurface.XAxis2.LargeTickSize = 0;

            Legend l = new Legend();

            l.NumberItemsVertically = 2;
            l.AttachTo(XAxisPosition.Bottom, YAxisPosition.Left);
            l.HorizontalEdgePlacement = NPlot.Legend.Placement.Outside;
            l.VerticalEdgePlacement   = NPlot.Legend.Placement.Inside;
            l.XOffset     = 5;
            l.YOffset     = 50;
            l.BorderStyle = NPlot.LegendBase.BorderType.Line;

            plotSurface.Legend = l;

            plotSurface.Title =
                "Sales Growth Compared to\n" +
                "Average Sales Growth by Store Size - Rank Order Low to High";

            plotSurface.Refresh();
        }
        public void OnLoadingFinished(Dictionary <ChannelInfo, DataTable> tables)
        {
            graph.Clear();

            Grid myGrid = new Grid();

            myGrid.VerticalGridType   = Grid.GridType.Fine;
            myGrid.HorizontalGridType = Grid.GridType.Coarse;
            graph.Add(myGrid);

            Color[] availableColors = new Color[]
            {
                Color.Blue,
                Color.Red,
                Color.Violet,
                Color.Black,
                Color.Cyan,
                Color.Brown,
                Color.Yellow
            };

            int trendNum = 0;

            foreach (ChannelInfo channelInfo in tables.Keys)
            {
                int        valueColumnIndex = tables[channelInfo].Columns.IndexOf("Value");
                int        timeColumnIndex  = tables[channelInfo].Columns.IndexOf("Time");
                int        valueCount       = tables[channelInfo].Rows.Count;
                double[]   values           = new double[valueCount];
                DateTime[] labels           = new DateTime[valueCount];
                for (int i = 0; i < valueCount; i++)
                {
                    double.TryParse(tables[channelInfo].Rows[i].ItemArray[valueColumnIndex].ToString(), out values[i]);
                    DateTime.TryParse(tables[channelInfo].Rows[i].ItemArray[timeColumnIndex].ToString(), out labels[i]);
                }

                LinePlot lp = new LinePlot();
                lp.DataSource   = values;
                lp.AbscissaData = labels;
                lp.Color        = availableColors[trendNum % availableColors.Length];
                lp.Label        = channelInfo.ChannelName;

                graph.Add(lp);

                trendNum++;
            }

            Legend legend = new Legend();

            legend.AttachTo(PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Right);
            legend.HorizontalEdgePlacement = Legend.Placement.Inside;
            legend.VerticalEdgePlacement   = Legend.Placement.Outside;
            legend.XOffset = 10;
            legend.YOffset = -10;

            graph.Legend       = legend;
            graph.LegendZOrder = 1;

            graph.Visible  = true;
            label1.Visible = false;

            Cursor = Cursors.Default;
        }
Пример #9
0
        public void InitDataToChart()
        {
            //图例
            legend = new Legend();
            legend.AttachTo(PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Left);
            legend.VerticalEdgePlacement   = Legend.Placement.Inside;
            legend.HorizontalEdgePlacement = Legend.Placement.Outside;
            legend.YOffset                 = -5;
            legend.BorderStyle             = LegendBase.BorderType.Line;
            legend.NumberItemsHorizontally = 2;
            legend.Font          = new Font(FontFamily.GenericSerif, 8, FontStyle.Regular);
            legend.AutoScaleText = false;
            //网格
            grid = new Grid();
            grid.HorizontalGridType = Grid.GridType.Fine;
            grid.VerticalGridType   = Grid.GridType.Fine;
            grid.MajorGridPen.Color = Color.Silver;
            grid.MinorGridPen.Color = Color.Silver;
            /////////////////////////////////////////////
            //直线图
            linePlot = new LinePlot();
            linePlot.OrdinateData = cart.regressY;
            linePlot.AbscissaData = xList;
            linePlot.Color        = Color.Orange;
            linePlot.Pen.Width    = 2.0f;
            //点图
            Marker marker = new Marker(Marker.MarkerType.FilledCircle, 3, new Pen(Color.Blue));

            marker.FillBrush       = new SolidBrush(Color.RoyalBlue);
            pointPlot              = new PointPlot(marker);
            pointPlot.AbscissaData = xList;
            pointPlot.OrdinateData = yList;
            pointPlot.ShowInLegend = false;
            if (cart.regressXYB > 0)
            {
                linePlot.Label = yLabel + "=" + cart.regressXYA.ToString("F2") + "*" + xLabel + "+" + cart.regressXYB.ToString("F2")
                                 + ",R=" + cart.correlationXY.ToString("F2");
            }
            else
            {
                linePlot.Label = yLabel + "=" + cart.regressXYA.ToString("F2") + "*" + xLabel + cart.regressXYB.ToString("F2")
                                 + ",R=" + cart.correlationXY;
            }
            label1.Text = xLabel + "(m:" + cart.xMean.ToString("F1") + ",s':" + cart.xVar.ToString("F1")
                          + ")  " + yLabel + "(m:" + cart.yMean.ToString("F1") + ",s':" + cart.yVar.ToString("F1") + ")";
            //添加
            chart.Add(grid);
            chart.Add(linePlot);
            chart.Add(pointPlot);
            //设置属性
            chart.XAxis1.Label = xLabel + ":" + xUnit;
            chart.YAxis1.Label = yLabel + ":" + yUnit;
            chart.YAxis1.LabelOffsetAbsolute = true;
            chart.Padding = 5;
            chart.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.VerticalGuideline());
            chart.AddAxesConstraint(new AxesConstraint.AxisPosition(PlotSurface2D.YAxisPosition.Left, 60));
            chart.PlotBackColor = Color.White;
            chart.BackColor     = System.Drawing.SystemColors.Control;
            chart.XAxis1.Color  = Color.Black;
            chart.YAxis1.Color  = Color.Black;
            chart.Legend        = legend;
            chart.LegendZOrder  = 1;
            chart.Refresh();
        }
Пример #10
0
        public void InitDataToChart()
        {
            //清空
            chart1.Clear();
            chart2.Clear();
            chart3.Clear();
            //垂直线
            vline = new VerticalLine(0, Color.Blue);
            //图例
            legend = new Legend();
            legend.AttachTo(PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Left);
            legend.VerticalEdgePlacement   = Legend.Placement.Inside;
            legend.HorizontalEdgePlacement = Legend.Placement.Outside;
            legend.YOffset                 = -5;
            legend.BorderStyle             = LegendBase.BorderType.Line;
            legend.NumberItemsHorizontally = 4;
            //网格
            grid = new Grid();
            grid.HorizontalGridType = Grid.GridType.Fine;
            grid.VerticalGridType   = Grid.GridType.Fine;
            grid.MajorGridPen.Color = Color.Silver;
            grid.MinorGridPen.Color = Color.Silver;
            /////区域着色////////
            fill       = new FilledRegion(new VerticalLine(-1), new VerticalLine(8));
            fill.Brush = new SolidBrush(Color.FromArgb(250, 218, 169));
            /////////////////////////////////////////////
            //直线图
            sysPlot = new LinePlot();
            sysPlot.OrdinateData = sysList;
            sysPlot.AbscissaData = timeList;
            sysPlot.Color        = Color.RoyalBlue;
            sysPlot.Pen.Width    = 2.0f;
            sysPlot.Label        = "SYS";

            diaPlot = new LinePlot();
            diaPlot.OrdinateData = diaList;
            diaPlot.AbscissaData = timeList;
            diaPlot.Color        = Color.OrangeRed;
            diaPlot.Pen.Width    = 2.0f;
            diaPlot.Label        = "DIA";

            mapPlot = new LinePlot();
            mapPlot.OrdinateData = mapList;
            mapPlot.AbscissaData = timeList;
            mapPlot.Color        = Color.Chartreuse;
            mapPlot.Pen.Width    = 2.0f;
            mapPlot.Label        = "MAP";

            hrPlot = new LinePlot();
            hrPlot.OrdinateData = hrList;
            hrPlot.AbscissaData = timeList;
            hrPlot.Color        = Color.DarkSlateBlue;
            hrPlot.Pen.Width    = 2.0f;

            sys_hrPlot = new LinePlot();
            sys_hrPlot.OrdinateData = sys_hrList;
            sys_hrPlot.AbscissaData = timeList;
            sys_hrPlot.Color        = Color.Green;
            sys_hrPlot.Pen.Width    = 2.0f;

            //水平线
            hline1 = new HorizontalLine(70, Color.Gray);
            hline2 = new HorizontalLine(90, Color.Gray);
            hline3 = new HorizontalLine(120, Color.Gray);
            hline4 = new HorizontalLine(140, Color.Gray);

            ///////////////////////
            chart1.Add(fill);
            chart1.Add(grid);
            chart1.Add(sysPlot);
            chart1.Add(diaPlot);
            chart1.Add(mapPlot);
            chart1.Add(hline1);
            chart1.Add(hline2);
            chart1.Add(hline3);
            chart1.Add(hline4);
            chart1.Add(vline);
            chart1.XAxis1.HideTickText        = true;
            chart1.YAxis1.Label               = "血压:mmHg";
            chart1.YAxis1.LabelOffsetAbsolute = true;
            chart1.YAxis1.WorldMin            = chart1.YAxis1.WorldMin - 20;
            chart1.YAxis1.WorldMax            = chart1.YAxis1.WorldMax + 20;
            chart1.Padding = 5;
            chart1.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.HorizontalDrag());
            chart1.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.VerticalDrag());
            chart1.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.VerticalGuideline());
            chart1.AddAxesConstraint(new AxesConstraint.AxisPosition(PlotSurface2D.YAxisPosition.Left, 60));
            chart1.InteractionOccured += new xuzhenzhen.com.chart.Windows.PlotSurface2D.InteractionHandler(chart1_InteractionOccured);
            chart1.PlotBackColor       = Color.White;
            chart1.BackColor           = System.Drawing.SystemColors.Control;
            chart1.XAxis1.Color        = Color.Black;
            chart1.YAxis1.Color        = Color.Black;
            chart1.Legend              = legend;
            chart1.LegendZOrder        = 1;
            chart1.Refresh();
            ///////////////////////////
            chart2.Add(fill);
            chart2.Add(grid);
            chart2.Add(hrPlot);
            chart2.Add(vline);
            chart2.XAxis1.HideTickText        = true;
            chart2.YAxis1.Label               = "心率:BPM";
            chart2.YAxis1.LabelOffsetAbsolute = true;
            chart2.Padding = 5;
            chart2.AddAxesConstraint(new AxesConstraint.AxisPosition(PlotSurface2D.YAxisPosition.Left, 60));
            chart2.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.HorizontalDrag());
            chart2.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.VerticalDrag());
            chart2.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.VerticalGuideline());
            chart2.InteractionOccured += new xuzhenzhen.com.chart.Windows.PlotSurface2D.InteractionHandler(chart2_InteractionOccured);
            chart2.PlotBackColor       = Color.White;
            chart2.BackColor           = System.Drawing.SystemColors.Control;
            chart2.XAxis1.Color        = Color.Black;
            chart2.YAxis1.Color        = Color.Black;
            chart2.Refresh();
            ///////////////////////////
            chart3.Add(fill);
            chart3.Add(grid);
            chart3.Add(sys_hrPlot);
            chart3.Add(vline);
            LabelAxis axis = new LabelAxis(chart3.XAxis1);
            int       tick = 1;

            if (chart2.XAxis1.WorldMax - chart2.XAxis1.WorldMin > 30)
            {
                tick = 2;
            }
            for (int i = (int)chart2.XAxis1.WorldMin; i <= chart2.XAxis1.WorldMax; i += tick)
            {
                int j = i % 24;
                if (j < 0)
                {
                    j += 24;
                }
                axis.AddLabel(Convert.ToString(j), i);
            }
            chart3.XAxis1       = axis;
            chart3.XAxis1.Label = "Time:Hour";
            chart3.YAxis1.Label = "SYS*PR/100";
            chart3.YAxis1.LabelOffsetAbsolute = true;
            chart3.Padding = 5;
            chart3.AddAxesConstraint(new AxesConstraint.AxisPosition(PlotSurface2D.YAxisPosition.Left, 60));
            chart3.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.HorizontalDrag());
            chart3.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.VerticalDrag());
            chart3.AddInteraction(new xuzhenzhen.com.chart.Windows.PlotSurface2D.Interactions.VerticalGuideline());
            chart3.InteractionOccured += new xuzhenzhen.com.chart.Windows.PlotSurface2D.InteractionHandler(chart3_InteractionOccured);
            chart3.PlotBackColor       = Color.White;
            chart3.BackColor           = System.Drawing.SystemColors.Control;
            chart3.XAxis1.Color        = Color.Black;
            chart3.YAxis1.Color        = Color.Black;
            chart3.Refresh();
            SetStatusNow();
        }