Beispiel #1
0
        //This gives us publication quality graphs
        public void AlterGraph(GraphingBase oldgraph)
        {
            Clear();
            DeepCopy(oldgraph);
            LegendState = true;
            Pane.Legend.IsShowLegendSymbols = false;
            Pane.Legend.Border.IsVisible    = false;
            BorderState           = false;
            Pane.Title.IsVisible  = false;
            Pane.Chart.Fill       = new Fill(Color.Transparent);
            Pane.IsPenWidthScaled = true;
            Pane.Fill             = new Fill(Color.Transparent);
            Pane.XAxis.Title.FontSpec.IsAntiAlias = true;
            Pane.YAxis.Title.FontSpec.IsAntiAlias = true;
            Pane.XAxis.Scale.FontSpec.IsAntiAlias = true;
            Pane.YAxis.Scale.FontSpec.IsAntiAlias = true;
            Pane.XAxis.Title.FontSpec.Size        = 26;
            Pane.YAxis.Title.FontSpec.Size        = 26;
            Pane.XAxis.Scale.FontSpec.Size        = 18;
            Pane.YAxis.Scale.FontSpec.Size        = 18;

            GraphCurveList.Where(curve => curve.IsLine).Cast <LineItem>().ForEach(curve =>
            {
                //This is needed, or else the top numbers of the graph are cut off.
                curve.Label.Text     = " ";
                curve.Label.FontSpec = new FontSpec("Garamond", (float)12.0, Color.Transparent, false, false, false);
                curve.Label.FontSpec.Border.IsVisible = false;

                if (curve.Line.Style != DashStyle.Solid)
                {
                    curve.Line.Width += 1;
                }
            });
        }
Beispiel #2
0
        //This gives us publication quality graphs
        public void AlterGraph(GraphingBase oldgraph)
        {
            Clear();
            DeepCopy(oldgraph);
            LegendState = true;
            Pane.Legend.IsShowLegendSymbols = false;
            Pane.Legend.Border.IsVisible    = false;
            BorderState           = false;
            Pane.Title.IsVisible  = false;
            Pane.Chart.Fill       = new Fill(Color.Transparent);
            Pane.IsPenWidthScaled = true;
            Pane.Fill             = new Fill(Color.Transparent);
            Pane.XAxis.Title.FontSpec.IsAntiAlias = true;
            Pane.YAxis.Title.FontSpec.IsAntiAlias = true;
            Pane.XAxis.Scale.FontSpec.IsAntiAlias = true;
            Pane.YAxis.Scale.FontSpec.IsAntiAlias = true;
            Pane.XAxis.Title.FontSpec.Size        = 26;
            Pane.YAxis.Title.FontSpec.Size        = 26;
            Pane.XAxis.Scale.FontSpec.Size        = 18;
            Pane.YAxis.Scale.FontSpec.Size        = 18;

            foreach (CurveItem c in GraphCurveList)
            {
                if (c.IsLine == true)
                {
                    //This is needed, or else the top numbers of the graph are cut off.
                    c.Label.Text     = " ";
                    c.Label.FontSpec = new FontSpec("Garamond", (float)12.0, Color.Transparent, false, false, false);
                    c.Label.FontSpec.Border.IsVisible = false;
                }
            }
        }
Beispiel #3
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;
        }
Beispiel #4
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);
            }

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

            int i = 0;

            foreach (CurveItem c in Pane.CurveList)
            {
                if (c.IsLine == true)
                {
                    (c as LineItem).Color            = Color.Black;
                    (c as LineItem).Symbol.Type      = SymbolType.None;
                    (c as LineItem).Line.Style       = (DashStyle)i;
                    (c as LineItem).Line.IsAntiAlias = ((LineItem)(graph.GraphCurveList[i])).Line.IsAntiAlias;
                }
            }

            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;
        }
Beispiel #5
0
        //This gives us publication quality graphs
        public void AlterGraph(GraphingBase oldgraph)
        {
            Clear();
            DeepCopy(oldgraph);
            LegendState = true;
            Pane.Legend.IsShowLegendSymbols = false;
            Pane.Legend.Border.IsVisible    = false;
            BorderState           = false;
            Pane.Title.IsVisible  = false;
            Pane.Chart.Fill       = new Fill(Color.Transparent);
            Pane.Fill             = new Fill(Color.Transparent);
            m_cZG.BackColor       = Color.Transparent;
            Pane.IsPenWidthScaled = true;
            Pane.Fill             = new Fill(Color.Transparent);
            Pane.XAxis.Title.FontSpec.IsAntiAlias = true;
            Pane.YAxis.Title.FontSpec.IsAntiAlias = true;
            Pane.XAxis.Scale.FontSpec.IsAntiAlias = true;
            Pane.YAxis.Scale.FontSpec.IsAntiAlias = true;
            Pane.XAxis.Title.FontSpec.Size        = 26;
            Pane.YAxis.Title.FontSpec.Size        = 26;
            Pane.XAxis.Scale.FontSpec.Size        = 18;
            Pane.YAxis.Scale.FontSpec.Size        = 18;

            for (int i = 0; i < GraphCurveList.Count; i++)
            {
                if (GraphCurveList[i].IsLine == true)
                {
                    //This is needed, or else the top numbers of the graph are cut off.
                    GraphCurveList[i].Label.Text     = " ";
                    GraphCurveList[i].Label.FontSpec = new FontSpec("Garamond", (float)12.0, Color.Transparent, false, false, false);
                    GraphCurveList[i].Label.FontSpec.Border.IsVisible = false;

                    if (((LineItem)GraphCurveList[i]).Line.Style != 0)
                    {
                        ((LineItem)GraphCurveList[i]).Line.Width += 1;
                    }
                }
            }
            Invalidate();
        }
Beispiel #6
0
 public void Copy(GraphingBase graph)
 {
     m_cMyPane          = graph.m_cMyPane.Clone();
     m_bThisisadeepcopy = false;
 }
Beispiel #7
0
        /// <summary>
        /// Initializes all members of the master graph and checks whether the master graph should load
        /// </summary>
        public MasterPaneForm()
        {
            InitializeComponent();

            m_gMyMaster = new GraphingBase(string.Empty);
            m_gMyMaster.CreateGraph(MasterGraph);

            m_gMyMaster.GraphMasterPane.PaneList.Clear();
            m_gMyMaster.GraphMasterPane.Title.IsVisible = false;

            // Fill the pane background with a nice looking color gradient
            m_gMyMaster.GraphMasterPane.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0F);

            // Set the margins and the space between panes to 10 points
            m_gMyMaster.GraphMasterPane.Margin.All   = 10;
            m_gMyMaster.GraphMasterPane.InnerPaneGap = 10;

            // Add the new GraphPane to the MasterPane
            if (GraphCollection.Instance.MainReflGraph.IsDeepCopyFull == true && GraphCollection.Instance.MainReflGraph.Hide == false)
            {
                GraphCollection.Instance.SetGraphUpdateLock = true;
                m_gMyMaster.GraphMasterPane.Add(GraphCollection.Instance.MainReflGraph.Pane);
                m_bAtleastonegraph = true;
            }

            if (GraphCollection.Instance.MainRhoGraph.IsDeepCopyFull == true && GraphCollection.Instance.MainRhoGraph.Hide == false)
            {
                GraphCollection.Instance.SetGraphUpdateLock = true;
                m_gMyMaster.GraphMasterPane.Add(GraphCollection.Instance.MainRhoGraph.Pane);
                m_bAtleastonegraph = true;
            }

            if (GraphCollection.Instance.RhoGraph.IsDeepCopyFull == true && GraphCollection.Instance.RhoGraph.Hide == false)
            {
                m_gMyMaster.GraphMasterPane.Add(GraphCollection.Instance.RhoGraph.Pane);
                m_bAtleastonegraph = true;
            }

            if (GraphCollection.Instance.ReflGraph.IsDeepCopyFull == true && GraphCollection.Instance.ReflGraph.Hide == false)
            {
                m_gMyMaster.GraphMasterPane.Add(GraphCollection.Instance.ReflGraph.Pane);
                m_bAtleastonegraph = true;
            }
            if (GraphCollection.Instance.ReflEGraph.IsDeepCopyFull == true && GraphCollection.Instance.ReflEGraph.Hide == false)
            {
                m_gMyMaster.GraphMasterPane.Add(GraphCollection.Instance.ReflEGraph.Pane);
                m_bAtleastonegraph = true;
            }
            //Align the graphs in a custom fashion. The default options don't maintain aspect ratio
            if (m_bAtleastonegraph)
            {
                int counter = 0;
                foreach (GraphPane i in m_gMyMaster.GraphMasterPane.PaneList)
                {
                    if (counter % 2 == 0)
                    {
                        RectangleF recf = new RectangleF(10, (340 / 2) * counter + 30, 439, 350);
                        i.Rect = recf;
                    }
                    else
                    {
                        RectangleF recf = new RectangleF(459, (340 / 2) * (counter - 1) + 30, 439, 350);
                        i.Rect = recf;
                    }
                    counter++;
                }

                //Create event handler for the context menu
                m_gMyMaster.GraphContextMenuBuilder(new ZedGraphControl.ContextMenuBuilderEventHandler(MyLocalGraphContextMenuBuilder));
            }
        }