private void CreatePlotterGraph()
        {
            using (display = new GraphLib.PlotterDisplayEx())
            {
                display           = new GraphLib.PlotterDisplayEx();
                display.Smoothing = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; //System.Drawing.Drawing2D.SmoothingMode.HighQuality; System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
                //
                // display
                //
                display.BackColor             = System.Drawing.Color.White;
                display.BackgroundColorBot    = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
                display.BackgroundColorTop    = System.Drawing.Color.Navy;
                display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                display.DashedGridColor       = System.Drawing.Color.Blue;
                display.Dock            = System.Windows.Forms.DockStyle.Fill;
                display.DoubleBuffering = true;
                display.Location        = new System.Drawing.Point(0, 24);
                display.Name            = "display";
                display.PlaySpeed       = 0.5F;
                display.Size            = new System.Drawing.Size(560, 200);
                display.SolidGridColor  = System.Drawing.Color.Blue;
                display.TabIndex        = 1;

                display.DataSources.Clear();
                display.SetDisplayRangeX(0, 600);

                display.DataSources.Add(new DataSource());
                //display.DataSources[0].Name = "Glucose Monitoring";
                display.DataSources[0].OnRenderXAxisLabel += RenderXLabel;

                display.DataSources[0].Length     = int.Parse(TimeText.Text);
                display.PanelLayout               = PlotterGraphPaneEx.LayoutMode.STACKED; ////  STACKED
                display.DataSources[0].AutoScaleY = true;
                display.DataSources[0].AutoScaleX = true;
                display.DataSources[0].SetDisplayRangeY(0, 300);
                display.DataSources[0].SetGridDistanceY(50);

                //display.DataSources[0].XAutoScaleOffset = 50;

                //display.DataSources[0].CurGraphWidth = 560;
                //display.DataSources[0].CurGraphHeight = 200;

                display.DataSources[0].GraphColor = System.Drawing.Color.Black;
                display.BackgroundColorTop        = System.Drawing.Color.White;
                display.BackgroundColorBot        = System.Drawing.Color.LightGray;
                display.SolidGridColor            = System.Drawing.Color.LightGray;
                display.DashedGridColor           = System.Drawing.Color.LightGray;

                cPoint[] src = display.DataSources[0].Samples;

                for (int i = 0; i < src.Length; i++)
                {
                    src[i].x = i;
                    src[i].y = 0;
                }
                iter = 0;
            }
        }
Beispiel #2
0
        private void BuildGraph(PlotterDisplayEx display, UInt32[] sig)
        {
            this.SuspendLayout();

            display.DataSources.Clear();
            display.SetDisplayRangeX(sig.Min(), sig.Max());

            display.DataSources.Add(new DataSource());
            display.DataSources[0].Name = "Graph " + (0 + 1);
            display.DataSources[0].OnRenderXAxisLabel += RenderXLabel;

            this.Text                         = "Tiled Graphs (vertical prefered) autoscaled";
            display.PanelLayout               = PlotterGraphPaneEx.LayoutMode.TILES_HOR;
            display.DataSources[0].Length     = sig.Length;
            display.DataSources[0].AutoScaleY = true;
            display.DataSources[0].SetDisplayRangeY(0, sig.Length);
            display.DataSources[0].SetGridDistanceY(100);
            CalcGraph(display.DataSources[0], sig);
        }
Beispiel #3
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);
                }
            }
        }
Beispiel #4
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);
        }