Example #1
0
        public virtual void DeepCopy(GraphingBase graph)
        {
            //this allows the class to be completely self contained on a deep copy. the calling function doesn't need to
            //create a graph
            if (ZGControl == null)
            {
                CreateGraph(null);
            }

            //Fix if we're updating from a thread
            if (ZGControl.InvokeRequired)
            {
                ZGControl.Invoke(new MethodInvoker(() => DeepCopy(graph)));
                return;
            }

            Title = graph.Title;
            SetAllFonts(graph.Pane.Title.FontSpec.Family, (int)graph.Pane.Title.FontSpec.Size, (int)graph.Pane.XAxis.Title.FontSpec.Size);
            SetAxisTitles(graph.Pane.XAxis.Title.Text, graph.Pane.YAxis.Title.Text);
            Pane.CurveList = graph.Pane.CurveList.Clone();

            var y = Pane.CurveList.Where(curve => curve.IsLine).Cast <LineItem>();

            Pane.CurveList.Where(curve => curve.IsLine).Cast <LineItem>().IndexedForEach((curve, index) =>
            {
                curve.Color            = Color.Black;
                curve.Symbol.Type      = SymbolType.None;
                curve.Line.Style       = (DashStyle)index;
                curve.Line.IsAntiAlias = true;
            });

            GraphSize                 = graph.GraphSize;
            BorderState               = graph.BorderState;
            Pane.YAxis.Type           = graph.Pane.YAxis.Type;
            Pane.YAxis.MinorTic.Color = graph.Pane.YAxis.MinorTic.Color;
            AxisChange();
            Pane.YAxis.Scale.Min       = graph.Pane.YAxis.Scale.Min;
            Pane.YAxis.Scale.Max       = graph.Pane.YAxis.Scale.Max;
            Pane.XAxis.Scale.Min       = graph.Pane.XAxis.Scale.Min;
            Pane.XAxis.Scale.Max       = graph.Pane.XAxis.Scale.Max;
            Pane.XAxis.MinorGrid.Color = Color.Transparent;
            Invalidate();
            IsThisaDeepCopy = true;
        }