Exemplo n.º 1
0
        public static void SetGridDistanceX(PlotterDisplayEx pdeGraph, int intX, bool autoRefresh = true)
        {
            if (pdeGraph == null || pdeGraph.DataSources == null || pdeGraph.DataSources.Count == 0)
            {
                return;
            }

            if (intX > 0)
            {
                intX++;
                pdeGraph.SetDisplayRangeX(0, intX);
                pdeGraph.SetGridDistanceX(10);

                if (autoRefresh)
                {
                    RefreshGraph(pdeGraph);
                }
            }
        }
Exemplo n.º 2
0
        public static void GraphInit(PlotterDisplayEx pdeGraph, string graphName = "")
        {
            if (pdeGraph == null)
            {
                return;
            }

            pdeGraph.DoubleBuffering    = true;
            pdeGraph.PanelLayout        = PlotterGraphPaneEx.LayoutMode.NORMAL;
            pdeGraph.Smoothing          = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            pdeGraph.BackgroundColorTop = Color.FromArgb(0, 15, 33);
            pdeGraph.BackgroundColorBot = Color.FromArgb(0, 15, 33);
            pdeGraph.SolidGridColor     = Color.FromArgb(0, 128, 0);
            pdeGraph.DashedGridColor    = Color.FromArgb(0, 128, 0);
            pdeGraph.StartingIndexOff   = 0;
            pdeGraph.DataSources.Clear();
            pdeGraph.DataSources.Add(GraphData.CreateDefault(graphName).Data);
            pdeGraph.SetPlayPanelInvisible();
            pdeGraph.SetDisplayRangeX(0, 60);
            pdeGraph.SetGridDistanceX(10);
            pdeGraph.SetStartingIdx(0);

            foreach (var control in pdeGraph.Controls)
            {
                if (control is VScrollBar vsBar && vsBar != null)
                {
                    SetGridDistanceY(pdeGraph, vsBar.Value);
                    break;
                }
            }

            foreach (var control in pdeGraph.Controls)
            {
                if (control is HScrollBar hBar && hBar != null)
                {
                    SetGridDistanceX(pdeGraph, hBar.Value);
                    break;
                }
            }

            RefreshGraph(pdeGraph);
        }