AttachTo() public method

Specify the Axes to attach the legend to.
public AttachTo ( PlotSurface2D xa, PlotSurface2D ya ) : void
xa PlotSurface2D Specify which horizontal axis the legend should be attached to.
ya PlotSurface2D Specify which vertical axis the legend should be attached to.
return void
Ejemplo n.º 1
0
        private void SetAxes(NPlot.Bitmap.PlotSurface2D npSurface, Font AxisFont, Font TickFont)
        {
            //X axis
            npSurface.XAxis1.Label               = "Time";
            npSurface.XAxis1.NumberFormat        = "{0:####0.0}";
            npSurface.XAxis1.TicksLabelAngle     = 90;
            npSurface.XAxis1.TickTextNextToAxis  = true;
            npSurface.XAxis1.FlipTicksLabel      = true;
            npSurface.XAxis1.LabelOffset         = 110;
            npSurface.XAxis1.LabelOffsetAbsolute = true;
            npSurface.XAxis1.LabelFont           = AxisFont;
            npSurface.XAxis1.TickTextFont        = TickFont;

            //Y axis
            npSurface.YAxis1.Label        = this.Title;
            npSurface.YAxis1.NumberFormat = "{0:####0.0}";
            npSurface.YAxis1.LabelFont    = AxisFont;
            npSurface.YAxis1.TickTextFont = TickFont;

            //Legend definition:
            NPlot.Legend npLegend = new NPlot.Legend();
            npLegend.AttachTo(NPlot.PlotSurface2D.XAxisPosition.Top, NPlot.PlotSurface2D.YAxisPosition.Right);
            npLegend.VerticalEdgePlacement   = Legend.Placement.Inside;
            npLegend.HorizontalEdgePlacement = Legend.Placement.Outside;
            npLegend.BorderStyle             = NPlot.LegendBase.BorderType.Line;
            npLegend.XOffset         = -5;
            npLegend.YOffset         = -20;
            npLegend.BackgroundColor = Color.White;

            npSurface.Legend = npLegend;

            //Update PlotSurface:
            npSurface.Refresh();
        }
Ejemplo n.º 2
0
        public void plot_nplot(out NPlot.Gtk.PlotSurface2D graph)
        {
            DateTime dt             = DateTime.Now;
            int      __width_factor = 45;
            int      __graph_width  = _c_device_logfile_entries.Count * __width_factor;

            NPlot.Gtk.PlotSurface2D _graph = new NPlot.Gtk.PlotSurface2D();

            _graph.SetSizeRequest(__graph_width, 500);

            _graph.ModifyBg(StateType.Normal, cutil.get_light_grey());

            Bitmap _graphBitmap = new Bitmap(1000, 500);

            DateTimeAxis x = new DateTimeAxis();
            LinearAxis   y = new LinearAxis(-50, 0);

            x.SmallTickSize = 10;
            x.LargeTickStep = new TimeSpan(0, 30, 0);
            x.NumberFormat  = "hh:mm";


            _graph.PlotBackImage         = _graphBitmap;
            _graph.YAxis1                = y;
            _graph.XAxis1                = x;
            _graph.XAxis1.Label          = _XAxisLabel;
            _graph.XAxis1.AutoScaleTicks = false;


            _graph.YAxis1.Label = _YAxisLabel;

            _linePlot.AbscissaData = _ar_x_axis_data;
            _linePlot.OrdinateData = _ar_y_axis_data;
            _linePlot.Label        = _title;
            _linePlot.ShowInLegend = true;
            _linePlot.Pen.Width    = 2.5f;
            _linePlot.Color        = Color.Orange;

            _linePlotLegend.AttachTo(NPlot.PlotSurface2D.XAxisPosition.Top, NPlot.PlotSurface2D.YAxisPosition.Left);
            _linePlotLegend.VerticalEdgePlacement   = NPlot.Legend.Placement.Inside;
            _linePlotLegend.HorizontalEdgePlacement = NPlot.Legend.Placement.Outside;
            _linePlotLegend.BorderStyle             = LegendBase.BorderType.Shadow;
            _linePlotLegend.YOffset = -10;
            _linePlotLegend.XOffset = -5;

            _graph.Legend        = _linePlotLegend;
            _graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            NPlot.Grid grid = new Grid();
            grid.HorizontalGridType = Grid.GridType.Fine;
            grid.VerticalGridType   = Grid.GridType.Fine;

            _graph.Add(grid, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left);
            _graph.Add(_linePlot);

            _graph.QueueDraw();

            graph = _graph;
        }
Ejemplo n.º 3
0
        public PointPlotSample()
            : base()
        {
            infoText = "";
            infoText += "Sinc Function Example. Demonstrates - \n";
            infoText += " * Charting LinePlot and PointPlot at the same time. \n";
            infoText += " * Adding a legend.";

            plotCanvas.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] = Math.Sin ((((double)i-50.0)/4.0))/(((double)i-50.0)/4.0);
                    b[i] *= mult;
                }
                a[i] += b[i];
            }

            Marker m = new Marker (Marker.MarkerType.Cross1, 6, Colors.Blue);
            PointPlot pp = new PointPlot (m);
            pp.OrdinateData = a;
            pp.AbscissaData = new StartStep (-500.0, 10.0);
            pp.Label = "Random";
            plotCanvas.Add (pp);

            LinePlot lp = new LinePlot ();
            lp.OrdinateData = b;
            lp.AbscissaData = new StartStep( -500.0, 10.0 );
            lp.LineColor = Colors.Red;
            lp.LineWidth = 2;
            plotCanvas.Add (lp);

            plotCanvas.Title = "Sinc Function";
            plotCanvas.YAxis1.Label = "Magnitude";
            plotCanvas.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;

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

            PackStart (plotCanvas.Canvas, true);
            Label la = new Label (infoText);
            PackStart (la);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
        public void PlotMarkers()
        {
            string[] lines = {
                "Markers Example. Demonstrates - ",
                "  * PointPlot and the available marker types",
                "  * Legends, and how to place them." };
            infoBox.Lines = lines;

            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();
        }
Ejemplo n.º 7
0
        private void PlotSincFunction()
        {
            string[] lines = {
                "Sinc Function Example. Demonstrates - ",
                "  * Charting line and point plot at the same time.",
                "  * Adding a legend." };

            infoBox.Lines = lines;

            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( PlotSurface2D.XAxisPosition.Top, PlotSurface2D.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();
        }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
0
        public void PlotMarkers()
        {
            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;
            plotSurface.Legend = legend;

            plotSurface.Refresh();
        }
Ejemplo n.º 10
0
        private void PlotSincFunction()
        {
            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( PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Left );
            legend.VerticalEdgePlacement = Legend.Placement.Inside;
            legend.HorizontalEdgePlacement = Legend.Placement.Inside;

            plotSurface.Legend = new Legend();

            plotSurface.Refresh();
        }
Ejemplo n.º 11
0
        private void SetAxes(NPlot.Bitmap.PlotSurface2D npSurface, Font AxisFont, Font TickFont)
        {
            //X axis
            npSurface.XAxis1.Label = "Time";
            npSurface.XAxis1.NumberFormat = "{0:####0.0}";
            npSurface.XAxis1.TicksLabelAngle = 90;
            npSurface.XAxis1.TickTextNextToAxis = true;
            npSurface.XAxis1.FlipTicksLabel = true;
            npSurface.XAxis1.LabelOffset = 110;
            npSurface.XAxis1.LabelOffsetAbsolute = true;
            npSurface.XAxis1.LabelFont = AxisFont;
            npSurface.XAxis1.TickTextFont = TickFont;

            //Y axis
            npSurface.YAxis1.Label = this.Title;
            npSurface.YAxis1.NumberFormat = "{0:####0.0}";
            npSurface.YAxis1.LabelFont = AxisFont;
            npSurface.YAxis1.TickTextFont = TickFont;

            //Legend definition:
            NPlot.Legend npLegend = new NPlot.Legend();
            npLegend.AttachTo(NPlot.PlotSurface2D.XAxisPosition.Top, NPlot.PlotSurface2D.YAxisPosition.Right);
            npLegend.VerticalEdgePlacement = Legend.Placement.Inside;
            npLegend.HorizontalEdgePlacement = Legend.Placement.Outside;
            npLegend.BorderStyle = NPlot.LegendBase.BorderType.Line;
            npLegend.XOffset = -5;
            npLegend.YOffset = -20;
            npLegend.BackgroundColor = Color.White;

            npSurface.Legend = npLegend;

            //Update PlotSurface:
            npSurface.Refresh();
        }
Ejemplo n.º 12
0
        public void RefreshPlots(NPlot.Windows.PlotSurface2D graphSurface)
        {
            graphSurface.Clear();

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

            foreach (XYData plot in _plots)
            {
                LinePlot lp = new LinePlot();
                lp.Color = plot.PlotColour;
                lp.AbscissaData = plot.xData;
                lp.OrdinateData = plot.yData;
                lp.Label = plot.PlotName;
                graphSurface.Add(lp);
            }

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

            graphSurface.Refresh();

            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;
            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();
        }