Beispiel #1
0
 private void axisChangeZedGraph(ZedGraphControl zg)
 {
     if (zg.InvokeRequired)
     {
         axisChangeZedGraphCallBack ad = new axisChangeZedGraphCallBack(axisChangeZedGraph);
         zg.Invoke(ad, new object[] { zg });
     }
     else
     {
         zg.AxisChange();
         zg.Invalidate();
         zg.Refresh();
     }
 }
Beispiel #2
0
        public override void ChartClear(object tChart)
        {
            ZedGraphControl chart = (ZedGraphControl)tChart;

            if (chart.InvokeRequired)
            {
                SetchartClearCallback d = new SetchartClearCallback(ChartClear);
                chart.Invoke(d, new object[] { chart });
            }
            else
            {
                chart.GraphPane.CurveList.Clear();
                chart.Refresh();
            }
        }
Beispiel #3
0
 private void axisChangeZedGraph(ZedGraphControl zg)
 {
     if (zg.InvokeRequired)
     {
         axisChangeZedGraphCallBack ad = new axisChangeZedGraphCallBack(axisChangeZedGraph);
         zg.Invoke(ad, new object[] { zg });
     }
     else
     {
         //double xRange = myPane.XAxis.Scale.Max - myPane.XAxis.Scale.Min;
         //myPane.XAxis.Scale.Max = watch1.ElapsedMilliseconds;
         //myPane.XAxis.Scale.Min = myPane.XAxis.Scale.Max - xRange;
         zg.AxisChange();
         zg.Invalidate();
         zg.Refresh();
     }
 }
Beispiel #4
0
 /// <summary>
 /// This extension method appends collored text.
 /// </summary>
 public static void AddGraphFromThread(this ZedGraphControl graphBox, string label, IPointList points, Color color, SymbolType symbolType)
 {
     // If this method was called from the another thread.
     if (graphBox.InvokeRequired)
     {
         var deleg = new SetGraphAddGraphCallback(AddGraphFromThread);
         graphBox.Invoke(deleg, new object[] { graphBox, label, points, color, symbolType });
     }
     else
     {
         graphBox.GraphPane.XAxis.Title.Text = "Depth points, (each points is time of one scan step), nS";
         graphBox.GraphPane.YAxis.Title.Text = "Rx amplitude, points)";
         graphBox.GraphPane.AddCurve(label, points, color, symbolType);
         graphBox.AxisChange();
         graphBox.Refresh();
         //graphBox.ZoomOutAll(graphBox.GraphPane);
     }
 }
Beispiel #5
0
        public override void DrawLine(object tChart, plotData temp, string seriName, LineType lineType)
        {
            ZedGraphControl chart  = (ZedGraphControl)tChart;
            GraphPane       myPane = chart.GraphPane;

            if (chart.InvokeRequired)
            {
                SetDrawLineCallBack d = DrawLine;
                chart.Invoke(d, new object[] { chart, temp, seriName, lineType });
            }
            else
            {
                PointPairList list = new PointPairList();
                //int length = temp.xData.Length;

                //for (int i = 0; i < length; i++)
                //{
                //    list.Add(temp.xData[i],temp.yData[i]);

                //}
                //double[]a=new double[100];
                // Generate a blue curve with circle symbols, and "My Curve 2" in the legend
                LineItem myCurve1 =
                    new LineItem(seriName, temp.xData.Select(x => (double)x).ToArray(), temp.yData.Select(x => (double)x).ToArray(),
                                 lineType == LineType.Spec ? Color.Red : GetRandomColor(), SymbolType.None, 1.5f);
                myCurve1.Line.IsSmooth          = true;
                myCurve1.Line.IsAntiAlias       = true;
                myCurve1.Line.SmoothTension     = 0.1F;
                myCurve1.Line.GradientFill.Type = FillType.Brush;
                myPane.CurveList.Add(myCurve1);
                // myPane.AddCurve(seriName, temp.xData.Select(x => (double)x).ToArray(), temp.yData.Select(x => (double)x).ToArray(), lineType == LineType.Spec ? Color.Red : Util.getRandomColor(), SymbolType.None);

                myPane.Legend.Position = LegendPos.InsideBotRight;
                //chart.Font = new System.Drawing.Font("Consolas", 20.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                myPane.Legend.FontSpec.Family = "Consolas";
                // myPane.Legend.FontSpec.Size = 25;



                chart.AxisChange();
                //chart.IsAntiAlias = true;
                chart.Refresh();
            }
        }