Esempio n. 1
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();
        }