Beispiel #1
0
        public void DrawGraph(double[,] ArrayArray)
        {
            int       i    = 0;
            GraphPane Pane = zedGraph.GraphPane;

            Pane.CurveList.Clear();
            PointPairList PairList   = new PointPairList();
            PointPairList PairList_2 = new PointPairList();
            PointPairList PairList_3 = new PointPairList();
            double        xmin       = 0;
            double        xmax       = 3;

            for (double x = xmin; x <= xmax; x += 0.01)
            {
                PairList.Add(x, ArrayArray[0, Convert.ToInt32(100 * x)]);
                PairList_2.Add(x, ArrayArray[1, Convert.ToInt32(100 * x)]);
                PairList_3.Add(x, ArrayArray[2, Convert.ToInt32(100 * x)]);
            }
            i++;
            LineItem myCurve   = Pane.AddCurve("Factor = 0.2", PairList, Color.Black, SymbolType.None);
            LineItem myCurve_2 = Pane.AddCurve("Factor = 0.5", PairList_2, Color.Blue, SymbolType.None);
            LineItem myCurve_3 = Pane.AddCurve("Factor = 0.8", PairList_3, Color.Red, SymbolType.None);

            zedGraph.AxisChange();
            zedGraph.Refresh();
        }
Beispiel #2
0
    public void SetCurrentTorrent(Torrent torrent)
    {
        currentTorrent = torrent;

        Pane.CurveList.Clear();

        if (currentTorrent != null)
        {
            currentTorrentDownloadCurve = Pane.AddCurve("Current Torrent Download", currentTorrent.DownloadGraphData, System.Drawing.Color.Red, SymbolType.Circle);
            //currentTorrentDownloadCurve.Line.Fill = new Fill(System.Drawing.Color.White, System.Drawing.Color.Red, 45F);

            currentTorrentUploadCurve = Pane.AddCurve("Current Torrent Upload", currentTorrent.UploadGraphData, System.Drawing.Color.Blue, SymbolType.Circle);
            //currentTorrentUploadCurve.Line.Fill = new Fill(System.Drawing.Color.White, System.Drawing.Color.Blue, 45F);
        }

        if (totalDownloadCurve != null)
        {
            totalDownloadCurve = Pane.AddCurve("Total Download", MainForm.torrentManager.DownloadGraphData, System.Drawing.Color.Green, SymbolType.Circle);
            //totalDownloadCurve.Line.Fill = new Fill(System.Drawing.Color.White, System.Drawing.Color.Green, 45F);
        }

        if (totalUploadCurve != null)
        {
            totalUploadCurve = Pane.AddCurve("Total Upload", MainForm.torrentManager.UploadGraphData, System.Drawing.Color.Yellow, SymbolType.Circle);
            //totalUploadCurve.Line.Fill = new Fill(System.Drawing.Color.White, System.Drawing.Color.Yellow, 45F);
        }

        zgc.AxisChange();
        //zgc.Invalidate();
        zgc.Refresh();
    }
Beispiel #3
0
        // METODO per il disegno grafico DR
        public void CreateGraphDeadReckoning(ZedGraphControl zgc, double[] spostamentoX, double[] spostamentoY)
        {
            if (zgc.InvokeRequired)
            {
                refreshInvokeDR d = new refreshInvokeDR(CreateGraphDeadReckoning);
                zgc.Invoke(d, zgc, spostamentoX, spostamentoY);
            }
            else
            {
                zgc.AxisChange();
                zgc.Invalidate();
                zgc.Refresh();

                GraphPane myPane = zgc.GraphPane;
                myPane.Title.Text = "Estimated 2D path";

                for (int i = 0; i < spostamentoX.Length; i++)
                {
                    myPane.CurveList[0].AddPoint(new PointPair(spostamentoX[i], spostamentoY[i]));
                    zgc.AxisChange();
                    zgc.Invalidate();
                    zgc.Refresh();
                }

                zgc.AxisChange();
                zgc.Invalidate();
                zgc.Refresh();
                startIndexDR = spostamentoX.Length;
            }
        }
Beispiel #4
0
 void Legend_Click(object sender, EventArgs e)
 {
     zedGraph.GraphPane.Legend.IsVisible = !zedGraph.GraphPane.Legend.IsVisible;
     ((ToolStripMenuItem)sender).Checked = zedGraph.GraphPane.Legend.IsVisible;
     zedGraph.AxisChange();
     zedGraph.Refresh();
 }
Beispiel #5
0
        private void CreateGraph(ZedGraphControl zgc1, Array x_value1, Array y_value1, double x_min1, double x_max1)
        {
            zgc1.GraphPane.CurveList.Clear();
            zgc1.Refresh();
            GraphPane myPane = zgc1.GraphPane;

            // Set the titles and axis labels
            myPane.Title.Text       = "图像直方图";
            myPane.XAxis.Title.Text = "像元值";
            myPane.YAxis.Title.Text = "像元个数";

            PointPairList list = new PointPairList();

            for (int i = 0; i < y_value1.Length; i++)    //256改为y_value.Length,纠正错误:有些影像的像元数不到256个,会产生索引溢出,by-zhzhx,
            {
                string a = x_value1.GetValue(i).ToString();
                string b = y_value1.GetValue(i).ToString();
                double x = Convert.ToDouble(a);
                double y = Convert.ToDouble(b);
                list.Add(x, y);
            }

            StickItem myCurve = myPane.AddStick("", list, Color.Blue);

            myCurve.Line.Width = 2.0f;
            //myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.XAxis.Scale.Max = x_max1;
            myPane.XAxis.Scale.Min = x_min1;
            //myPane.YAxis.Scale.MajorStep = 500;

            // Fill the axis background with a color gradient
            myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0F);
            zgc1.AxisChange();
            zgc1.Refresh();
        }
Beispiel #6
0
        private void DrawGraph(ZedGraphControl zgc)
        {
            WAVClass wAV;

            var N         = 4096;
            var amplitude = (int)numericAmplitude.Value;
            var phase     = (int)numericPhaze.Value;
            var frequency = (int)numericFreqiency.Value;
            var signal    = (Signal)comboBoxSignals.SelectedIndex;

            PointPairList pointPair = ComputePoints(amplitude, phase, frequency, N, signal);

            GraphPane myPane = zgc.GraphPane;

            zgc.AxisChange();
            zgc.Refresh();
            zgc.GraphPane.CurveList.Clear();
            LineItem myCurve = myPane.AddCurve(signal.ToString(),
                                               pointPair, Color.Blue, SymbolType.None);

            zgc.AxisChange();
            zgc.Refresh();

            wAV = new WAVClass();
            try
            {
                wAV.Save(signal, amplitude, frequency, phase, checkBoxNoize.Checked);
            }
            catch (Exception) { }
        }
Beispiel #7
0
        void AddTemperatureCurve()
        {
            LineItem myCurve;
            //if (tempetureCurveInfoList.HasNodes())
            {
                this.zedGraphControl1.GraphPane.Title.Text  = "温度曲线图";
                zedGraphControl1.GraphPane.XAxis.Title.Text = "时间";
                zedGraphControl1.GraphPane.YAxis.Title.Text = "温度值";
                //zedGraphControl1.GraphPane.XAxis.Type = ZedGraph.AxisType.Date; ;
                //zedGraphControl1.GraphPane.XAxis.Type = ZedGraph.AxisType.DateAsOrdinal; ;

                //zg1.GraphPane.XAxis.MajorTic.PenWidth = 8.0F;
                foreach (CurveInfo ci in tempetureCurveInfoList)
                {
                    zedGraphControl1.GraphPane.AddCurve(
                        ci.CurveName,
                        ci.PointPairList, ci.CurveColor, SymbolType.Diamond);
                }

                //zedGraphControl1.GraphPane.AddCurve(
                //            tempCurveInfo.CurveName,
                //            tempCurveInfo.PointPairList,
                //           tempCurveInfo.CurveColor, SymbolType.None);
                //myCurve = zedGraphControl1.GraphPane.AddCurve("温度", this.pointPairList, Color.DarkGreen, SymbolType.None);
                zedGraphControl1.AxisChange();
                zedGraphControl1.Refresh();
            }
        }
Beispiel #8
0
        private void GraphForceRedraw()
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(() => graphControl.Refresh()));
                System.Threading.Thread.Sleep(1);
                return;
            }

            graphControl.Refresh();
        }
        void UpdateErrorGraph()
        {
            double error = clf.errorQueue.Dequeue();

            errorGraph.CurveList.Clear();
            errorPointsList.Add(new PointPair(errorIndex, error));
            LineItem errorCurve = errorGraph.AddCurve("Error", errorPointsList, System.Drawing.Color.Blue, SymbolType.None);

            zedGraph.AxisChange();
            //zedGraph.Invalidate();
            zedGraph.Refresh();

            errorIndex += 1;
        }
Beispiel #10
0
        /// <summary>
        /// Create a bar graph for the given labels and values arrays.
        /// </summary>
        public void CreateBars(string[] labels, double[] values)
        {
            var pane = _graphControl.GraphPane;

            pane.CurveList.Clear();

            pane.AddBar(null, null, values, Color.Red);
            pane.XAxis.Scale.TextLabels = labels.ToArray();
            pane.XAxis.Type             = AxisType.Text;

            _graphControl.AxisChange();
            GraphUtilities.ScaleAxisLabels(_graphControl.Width, pane);
            _graphControl.Refresh();
        }
        public bool MouseMove1(object sender, MouseEventArgs e)
        {
            if (pointList == null || modelNames == null)
            {
                return(false);
            }

            //only update every quarter of a second
            DateTime now = DateTime.Now;

            if ((now - lastUpdate).Milliseconds < 250)
            {
                return(false);
            }

            ZedGraphControl zgc = (ZedGraphControl)sender;

            PointF    currentPoint = (PointF)e.Location;
            CurveItem curveItem;
            int       closestPoint;

            if (zgc.GraphPane.FindNearestPoint(currentPoint, allPointsCurve, out curveItem, out closestPoint))
            {
                //add tooltip showing the model name
                tt.Show(modelNames[closestPoint], zgc.ParentForm, new Point((int)e.X + 15, (int)e.Y - 15), 2000);

                //put a circle around the current point
                currentList.Clear();
                currentList.Add(new PointPair(pointList[periodToShow][closestPoint]));
                circle = zgc.GraphPane.AddCurve("", currentList, Color.Black, SymbolType.Circle);
                circle.Line.IsVisible          = false;
                circle.Symbol.Border.IsVisible = true;
                circle.Symbol.Fill.IsVisible   = false;
                circle.Symbol.Size             = 8;
                zgc.Refresh();

                lastPoint  = e.Location;
                lastUpdate = DateTime.Now;
            }
            else
            {
                currentList.Clear();
                circle = zgc.GraphPane.AddCurve("", currentList, Color.Black, SymbolType.Circle);
                zgc.Refresh();
            }

            return(false);
        }
Beispiel #12
0
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            double x, y;

            var pane = _zed.GraphPane;

            //
            // Пересчитываем пиксели в координаты на графике
            // у ZedGraph есть несколько перегруженных методов ReverseTransform.
            pane.ReverseTransform(e.Location, out x, out y);

            if (x < pane.XAxis.Scale.Min ||
                x > pane.XAxis.Scale.Max ||
                y < pane.YAxis.Scale.Min ||
                y > pane.YAxis.Scale.Max
                )//out of the bounds
            {
                OnMouseLeave(null, null);
            }
            else
            {
                if (_crossHairX != null && _crossHairY != null)
                {
                    pane.GraphObjList.Remove(_xHairOld);
                    pane.GraphObjList.Remove(_yHairOld);
                }

                LineObj xHair = new LineObj(pane.XAxis.Scale.Min, y, pane.XAxis.Scale.Max, y);
                xHair.Line.Style   = DashStyle.Custom;
                xHair.Line.DashOff = 5.0f;      // длина пропуска между пунктирами
                xHair.Line.DashOn  = 10.0f;     // длина пунктира
                LineObj yHair = new LineObj(x, pane.YAxis.Scale.Min, x, pane.YAxis.Scale.Max);
                yHair.Line.Style   = DashStyle.Custom;
                yHair.Line.DashOff = 5.0f;
                yHair.Line.DashOn  = 10.0f;

                pane.GraphObjList.Add(xHair);
                _xHairOld = xHair;

                pane.GraphObjList.Add(yHair);
                _yHairOld = yHair;

                _crossHairY = y;
                _crossHairX = x;

                _zed.Refresh();
            }
        }
        private void get_time_data_byMatlab(string strfile, ZedGraphControl zgc)
        {
            GraphPane myPane = zgc.GraphPane;

            myPane.Title.Text       = "加压信号时域波形";
            myPane.XAxis.Title.Text = "时间(ms)";
            myPane.YAxis.Title.Text = "电流(mA)";

            getTandFdataNative.getTandFdata getTandFdata = new getTandFdataNative.getTandFdata();
            object resultObj = getTandFdata.readtimedata(2, strfile);

            object[] resultObjs = (object[])resultObj;
            double[,] time_ms   = (double[, ])resultObjs[0];
            double[,] time_data = (double[, ])resultObjs[1];



            zgc.GraphPane.CurveList.Clear();
            PointPairList list1 = new PointPairList();

            for (int i = 0; i < 2 * 1024 * 1024 - 10; i++)
            {
                list1.Add(time_ms[0, i], time_data[i, 0]);
            }

            LineItem mCure = myPane.AddCurve("", list1, Color.Blue, SymbolType.None);

            zgc.AxisChange();

            zgc.Refresh();//重新刷新
        }
Beispiel #14
0
        private void CreateGraph(ZedGraphControl zgc)
        {
            //
            // clear old coordinates
            //
            myPane.CurveList.Clear();
            zgc.AxisChange();

            // Generate a LightBlue curve with circle symbols, and "My Curve" in the legend
            LineItem CurveS = myPane.AddCurve("Series GA", PPlist[0], Color.LightBlue, SymbolType.Diamond);
            // Generate a PaleVioletRed curve with circle symbols, and "My Curve" in the legend
            LineItem CurveP = myPane.AddCurve("Parallel GA", PPlist[1], Color.PaleVioletRed, SymbolType.Circle);

            float allPointSize = 50F;

            // Fill the area under the curve with a white-red gradient at 45 degrees
            CurveS.Line.Fill = new Fill(Color.Transparent, Color.LightBlue, allPointSize);
            // Make the symbols opaque by filling them with white
            CurveS.Symbol.Fill = new Fill(Color.Transparent);


            // Fill the area under the curve with a white-red gradient at 45 degrees
            CurveP.Line.Fill = new Fill(Color.Transparent, Color.PaleVioletRed, allPointSize);
            // Make the symbols opaque by filling them with white
            CurveP.Symbol.Fill = new Fill(Color.Transparent);


            // Calculate the Axis Scale Ranges
            zgc.AxisChange();
            zgc.Refresh();
        }
Beispiel #15
0
        private void CreatGraph_all(ZedGraphControl zgc)
        {
            GraphPane myPane = zgc.GraphPane;

            myPane.XAxis.Scale.MaxAuto = true;
            myPane.XAxis.Scale.MinAuto = true;
            myPane.YAxis.Scale.MaxAuto = true;
            myPane.YAxis.Scale.MinAuto = true;
            myPane.XAxis.MinSpace      = 1;
            myPane.YAxis.MinSpace      = 20;
            DataSet ds = new DataSet();

            myPane.Title.Text       = "个人全部数据";
            myPane.XAxis.Title.Text = "训练进度";
            myPane.YAxis.Title.Text = "训练分数";
            ds = btUS.GetSQL("select CorrectRate from R_SHFUnitScores where ProgramID=1030301 and StudentID=" + StudentID);
            double        x, y1;
            PointPairList list = new PointPairList();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                x  = i;
                y1 = double.Parse(ds.Tables[0].Rows[i][0].ToString());
                list.Add(x, y1);
            }
            LineItem mycurve = myPane.AddCurve("全部数据", list, Color.Red, SymbolType.Diamond);

            zgc.AxisChange();
            zgc.Refresh();
        }
        }     // ProcessEvent()

        //
        //
        //
        //
        #endregion// IEngine implementation


        #region IEngineControl Implementation
        // *****************************************************************
        // ****                     IEngineControl                      ****
        // *****************************************************************
        //
        public void Regenerate(object sender, EventArgs e)
        {
            if (this.InvokeRequired)
            {   // Not the window thread.
            }
            else
            {   // windows thread.
                // New: Update only periodically based on size of graph.
                int       size     = Math.Min(this.Size.Width, this.Size.Height);
                const int fullSize = 1000;
                if (size < fullSize)
                {
                    m_GraphPaintCount++;
                    int n = 1 + (fullSize - size) / 50;
                    m_GraphPaintCount = m_GraphPaintCount % n;
                }
                else
                {
                    m_GraphPaintCount = 0;
                }

                // Repaint the graphs now.
                bool            isGraphExist = false;
                ZedGraphControl zg1          = null;
                lock (GraphListLock)
                {
                    isGraphExist = m_GraphList.TryGetValue(m_CurrentZedGraphID, out zg1);
                }
                if (isGraphExist && m_GraphPaintCount == 0)
                {
                    zg1.AxisChange();
                    zg1.Refresh();
                }
            }
        }//Regenerate()
        private void CreateGraph(ZedGraphControl zgc)
        {
            GraphPane mypane = zgc.GraphPane;

            //// set the titles and axis labels
            mypane.Title.Text = "Prędkość = f(Czas)";
            //mypane.xaxis.title.text = "time";
            mypane.YAxis.Title.Text = "Obecna Prędkość";

            mypane.XAxis.Type            = AxisType.Date;
            mypane.XAxis.Title.Text      = "Czas (hh:mm:ss)";
            mypane.XAxis.Scale.Format    = "hh:mm:ss";
            mypane.XAxis.Scale.MajorUnit = DateUnit.Second;
            mypane.XAxis.Scale.MajorUnit = DateUnit.Second;
            mypane.XAxis.Scale.Max       = DateTime.Now.ToOADate();

            PointPairList curve    = new PointPairList();
            LineItem      mycurve2 = mypane.AddCurve("Prędkość Aktualna", curve, Color.Red, SymbolType.Circle);

            mycurve2.Line.Width = 5.0F;

            mypane.YAxis.Scale.MinAuto = true;
            mypane.YAxis.Scale.MaxAuto = true;
            mypane.XAxis.Scale.MinAuto = true;
            mypane.XAxis.Scale.MaxAuto = true;

            zgc.IsShowPointValues = true;
            zgc.AxisChange();
            zgc.Refresh();
            zgc.Visible = true;
        }
        private void get_FFT_data_byMatlab(string strfile, ZedGraphControl zgc)
        {
            GraphPane myPane = zgc.GraphPane;

            myPane.Title.Text       = "加压信号频域波形";
            myPane.XAxis.Title.Text = "频率(kHZ)";
            myPane.YAxis.Title.Text = "幅值";

            getTandFdataNative.getTandFdata getTandFdata = new getTandFdataNative.getTandFdata();
            object resultObj = getTandFdata.readpinyudata(2, strfile);

            object[] resultObjs = (object[])resultObj;
            double[,] Ff     = (double[, ])resultObjs[0];
            double[,] abs_Y8 = (double[, ])resultObjs[1];



            zgc.GraphPane.CurveList.Clear();
            PointPairList list1 = new PointPairList();

            for (int i = 0; Ff[0, i] < 20; i++)
            {
                list1.Add(Ff[0, i], abs_Y8[i, 0]);
            }

            LineItem mCure = myPane.AddCurve("", list1, Color.Blue, SymbolType.None);

            zgc.AxisChange();

            zgc.Refresh();//重新刷新
        }
Beispiel #19
0
        internal void CreatePane(string [] paths, ZedGraphControl zedGraph)
        {
            _paths    = paths;
            _zedGraph = zedGraph;
            _pane     = new GraphPane(new RectangleF(
                                          zedGraph.ClientRectangle.X,
                                          zedGraph.ClientRectangle.Y,
                                          zedGraph.ClientRectangle.Width,
                                          zedGraph.ClientRectangle.Height),
                                      GetTitle(),
                                      "Games", "Result (b)");


            _pane.XAxis.Scale.MinAuto = true;
            _pane.XAxis.Scale.MaxAuto = true;
            _pane.XAxis.Scale.MagAuto = false;
            _pane.XAxis.Scale.Mag     = 0;
            _pane.XAxis.Scale.Format  = "###,###";

            _pane.YAxis.Scale.MinAuto = true;
            _pane.YAxis.Scale.MaxAuto = true;
            _pane.YAxis.Scale.MagAuto = false;
            _pane.YAxis.Scale.Mag     = 0;
            _pane.YAxis.Scale.Format  = "###,###";

            zedGraph.MasterPane[0] = _pane;

            zedGraph.AxisChange();
            _zedGraph.Refresh();
        }
Beispiel #20
0
        //----Двигаем точки
        private bool zGraph_MouseDownEvent(ZedGraphControl control, MouseEventArgs e)
        {
            if (Control.ModifierKeys == Keys.Shift)
            {
                PointF mousePt = new PointF(e.X, e.Y);

                if (pane.FindNearestPoint(mousePt, out dragCurve, out dragIndex) &&
                    dragCurve.Points is PointPairList &&
                    dragCurve.YAxisIndex == 0 && dragCurve.Label.Text == "Curve3")
                {
                    startPt   = mousePt;
                    startPair = dragCurve.Points[dragIndex];

                    isDragPoint = true;

                    pane.ReverseTransform(mousePt, out startX, out startY);

                    hLine            = new LineObj(pane.XAxis.Scale.Min, startPair.Y, pane.XAxis.Scale.Max, startPair.Y);
                    hLine.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash;
                    vLine            = new LineObj(startPair.X, pane.YAxis.Scale.Min, startPair.X, pane.YAxis.Scale.Max);
                    vLine.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash;
                    pane.GraphObjList.Add(hLine);
                    pane.GraphObjList.Add(vLine);

                    control.Refresh();
                }
            }

            return(false);
        }
Beispiel #21
0
        /// <summary>
        /// ZedGraph 초기화
        /// </summary>
        /// <param name="zed">ZedGraphControl</param>
        /// <param name="lineColor">Color</param>
        /// <param name="title">title</param>
        private void zedInit(ZedGraphControl zed, Color lineColor, string title)
        {
            zed.GraphPane.CurveList.Clear();
            zed.GraphPane.GraphObjList.Clear();
            zed.Refresh();

            GraphPane myPane = zed.GraphPane;

            myPane.Title.Text                     = title;
            myPane.XAxis.Title.Text               = "count";
            myPane.YAxis.Title.Text               = "weight";
            myPane.XAxis.Title.IsVisible          = false;
            myPane.YAxis.Title.IsVisible          = false;
            myPane.XAxis.Scale.FontSpec.FontColor = Color.White;
            myPane.YAxis.Scale.FontSpec.FontColor = Color.White;
            myPane.Title.FontSpec.FontColor       = Color.White;
            myPane.Border.Color                   = Color.White;
            myPane.Chart.Border.Color             = Color.White;
            myPane.Fill       = new Fill(Color.FromArgb(43, 30, 30));
            myPane.Chart.Fill = new Fill(Color.FromArgb(43, 30, 30));

            RollingPointPairList list = new RollingPointPairList(60000);

            LineItem curve = myPane.AddCurve(title, list, lineColor, SymbolType.None);

            myPane.XAxis.Scale.Min       = 0;
            myPane.XAxis.Scale.Max       = 30;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MajorStep = 5;

            zed.AxisChange();
        }
Beispiel #22
0
        public void CreateChart(ZedGraphControl zgc)
        {
            EventHandler method = null;

            this._myMainPane.Title.Text                = this._reportTitle;
            this._myMainPane.XAxis.Title.Text          = "TOW";
            this._myMainPane.YAxis.Title.Text          = "Data";
            this._myMainPane.XAxis.IsVisible           = true;
            this._myMainPane.XAxis.Type                = AxisType.Linear;
            this._myMainPane.YAxis.MajorGrid.IsVisible = true;
            this._myMainPane.YAxis.MinorGrid.IsVisible = true;
            this._myMainPane.CurveList.Clear();
            this._myMainPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45f);
            if ((this._myMainXaxisData != null) && (this._myMainXaxisData.Length > 0))
            {
                this._myMainPane.AddCurve(this._curveLabel, this._myMainXaxisData, this._myMainYaxisData, this._curveColor, SymbolType.Diamond);
                this._myMainPane.AxisChange();
                if (method == null)
                {
                    method = delegate {
                        zgc.Update();
                        zgc.Refresh();
                    };
                }
                base.Invoke(method);
            }
            zgc.Size = new Size(base.ClientRectangle.Width - 0x19, base.ClientRectangle.Height - 40);
        }
Beispiel #23
0
        private void setingCurve(ZedGraphControl zed, string param, int num)
        {
            switch (num)
            {
            case 1:
                initList(list1, param, zed);
                myCurve1 = zed.GraphPane.AddCurve(param, list1, Color.WhiteSmoke, SymbolType.None);
                break;

            case 2:
                initList(list2, param, zed);
                myCurve2 = zed.GraphPane.AddCurve(param, list2, Color.WhiteSmoke, SymbolType.None);
                break;

            case 3:
                initList(list3, param, zed);
                myCurve3 = zed.GraphPane.AddCurve(param, list3, Color.WhiteSmoke, SymbolType.None);
                break;

            default:
                break;
            }
            zed.GraphPane.Chart.Fill = new Fill(System.Drawing.Color.Black);
            zed.AxisChange();
            zed.Refresh();
        }
Beispiel #24
0
        private bool DragPoint(ZedGraphControl control, MouseEventArgs e)
        {
            GraphPane myPane  = control.GraphPane;
            PointF    mousePt = new PointF(e.X, e.Y);

            // see if a dragging operation is underway
            if (isDragPoint)
            {
                // get the scale values that correspond to the current point
                double curX, curX2, curY, curY2;
                myPane.ReverseTransform(mousePt, out curX, out curX2, out curY, out curY2);
                // if it's a Y2 axis, use that value instead of Y
                if (graph.IsY2Axis)
                {
                    curY = curY2;
                }
                // calculate the new scale values for the point
                PointPair newPt = new PointPair(startPair.X + curX - startX, startPair.Y + curY - startY);
                // save the data back to the point list
                (graph.Points as PointPairList)[dragIndex] = newPt;
                // force a redraw
                control.Refresh();
            }
            return(false);
        }
Beispiel #25
0
        private void drawGraph(ZedGraphControl zedGraph, PointPairList list, string xTitle, string yTitle, string tableName)
        {
            GraphPane pane = zedGraph.GraphPane;
            //pane.CurveList.Clear();
            Color color;

            pane.XAxis.Title.Text = xTitle;
            pane.YAxis.Title.Text = yTitle;
            pane.Title.Text       = tableName;
            if (jIndex % 2 == 0)
            {
                color = Color.Blue;
            }
            else
            {
                color = Color.Red;
            }
            LineItem Curve = pane.AddCurve("", list, color, SymbolType.None);

            Curve.Line.IsSmooth = true;
            //pane.XAxis.MajorGrid.IsVisible = true;
            pane.YAxis.MajorGrid.IsVisible = true;
            zedGraph.Refresh();
            zedGraph.AxisChange();
            zedGraph.Invalidate();
            jIndex++;
        }
Beispiel #26
0
        /// <summary>
        /// 设置到饼状图上
        /// </summary>
        /// <param name="pane"></param>
        private void SetChart(DayReprot report, ZedGraphControl zgc)
        {
            GraphPane pane = zgc.GraphPane;

            pane.CurveList.Clear();
            pane.GraphObjList.Clear();
            pane.Title.Text = report.Date.ToString($"yyyy-MM-dd 生产情况");
            pane.Title.FontSpec.IsItalic = true;
            pane.Title.FontSpec.Size     = 12;
            pane.Title.FontSpec.Family   = "微软雅黑";

            //pane.Fill = new Fill(Color.White, Color.Goldenrod, 45.0f);
            //pane.Chart.Fill.Type = FillType.None;

            //pane.Legend.Position = LegendPos.Float;
            //pane.Legend.Location = new Location()
            addPie("生产时间", report.Times[TimeDefine.ProductTime].TotalMin, pane, Color.Navy);
            addPie("暂停时间", report.Times[TimeDefine.PauseTime].TotalMin, pane, Color.Yellow);
            addPie("DT时间", report.Times[TimeDefine.DTTime].TotalMin, pane, Color.Red);
            addPie("换线时间", report.Times[TimeDefine.ChangeLineTime].TotalMin, pane, Color.DarkRed);
            addPie("待板时间", report.Times[TimeDefine.WaitInputTime].TotalMin, pane, Color.Blue);
            addPie("进板时间", report.Times[TimeDefine.WaitOuputTime].TotalMin, pane, Color.Blue);
            pane.AxisChange();
            zgc.Refresh();
            zgc.Invalidate();
        }
Beispiel #27
0
        private void CreateTimeGraph(ZedGraphControl zgc, double[] sectionBuffers)
        {
            convertClkRate = int.Parse(SamplingTextbox.Text);
            sectionLength  = int.Parse(DataLengthtextBox.Text);
            int[]    time  = new int[sectionBuffers.Length];
            double[] timex = new double[sectionBuffers.Length];
            double[] storesectionBuffers = new double[10 * sectionBuffers.Length];
            for (int i = 0; i < sectionBuffers.Length; i++)
            {
                time[i]  = i;
                timex[i] = i;
                timex[i] = timex[i] / convertClkRate;
            }
            zgc.GraphPane.CurveList.Clear();
            GraphPane myPane = zgc.GraphPane;

            // Set the titles and axis labels
            double[] y = sectionBuffers;
            // Make up some data points from the Sine function
            LineItem myCurve;

            // Generate a blue curve with circle symbols, and "My Curve 2" in the legend
            myCurve            = zedGraphControl1.GraphPane.AddCurve("Channel 0 ", timex, y, Color.Blue, SymbolType.None);
            myCurve.Line.Width = 2.0f;
            // Make the symbols opaque by filling them with white
            myCurve.Symbol.Fill = new Fill(Color.White);
            // Fill the axis background with a color gradient
            zgc.AxisChange();
            zgc.Refresh();
            if (SavecheckBox.Checked)
            {
                sd.CreateExcelFile(time, timex, sectionBuffers);
            }
        }
Beispiel #28
0
        bool paintCurve(PointPairList[] pointListArray, ZedGraphControl paneArea)
        {
            dUse duse;

            if (pointListArray.Length > 6)
            {
                return(false);
            }
            Color[] colorArray = { Color.Gray, Color.Black, Color.DarkBlue, Color.Beige, Color.BlanchedAlmond, Color.BurlyWood };
            int     count      = 0;

            paneArea.GraphPane.CurveList.Clear();
            foreach (PointPairList pointList in pointListArray)
            {
                paneArea.GraphPane.AddCurve("", pointList, colorArray[count++], SymbolType.None);
            }
            paneArea.AxisChange();
            if (flgReceiving)
            {
                Invoke(duse = () =>
                {
                    paneArea.Refresh();
                });
            }
            return(true);
        }
Beispiel #29
0
        private void CreateGraph(string name, ZedGraphControl graph, Color color, string[] labels, double[] data)
        {
            graph.IsShowPointValues = true;
            graph.PointValueEvent  += GraphOnPointValueEvent;
            graph.MouseDownEvent   += GraphOnMouseDownEvent;
            graph.MouseUpEvent     += GraphOnMouseUpEvent;
            graph.MouseMoveEvent   += GraphMouseMoveEvent;
            var pane = graph.GraphPane;

            pane.CurveList.Clear();
            var bars = pane.AddBar(name, null, data, color);

            for (int i = 0; i < bars.NPts; i++)
            {
                bars[i].Tag = "{0}  ({1})".With(data[i], labels[i]);
            }
            bars.Bar.Fill                  = new Fill(color);
            pane.Title.FontSpec.Size       = 11;
            pane.XAxis.Scale.TextLabels    = labels;
            pane.XAxis.Type                = AxisType.Text;
            pane.XAxis.Scale.FontSpec.Size = 10;
            pane.XAxis.Scale.Align         = AlignP.Inside;
            pane.AxisChange();
            graph.Refresh();
        }
Beispiel #30
0
        bool paintCurve(PointPairList pointList, ZedGraphControl paneArea)
        {
            dUse  duse;
            Color color = Color.LawnGreen;

            paneArea.GraphPane.CurveList.Clear();
            paneArea.GraphPane.AddCurve("", pointList, color, SymbolType.None);
            paneArea.AxisChange();
            if (flgReceiving)
            {
                try
                {
                    Invoke(duse = () =>
                    {
                        paneArea.Refresh();
                    });
                }
                catch
                {
                    Invoke(duse = () =>
                    {
                        CloseAll();
                    });
                }
                return(true);
            }
            return(false);
        }
Beispiel #31
0
    private bool zedGraphControl1_MouseDownEvent( ZedGraphControl sender, MouseEventArgs e )
    {
        Point mousePt = new Point( e.X, e.Y );
            CurveItem curve;
            int iPt;
            if ( sender.GraphPane.FindNearestPoint( mousePt, out curve, out iPt ) &&
                    Control.ModifierKeys == Keys.Alt )
            {
                IPointListEdit list = curve.Points as IPointListEdit;
                if ( list == null )
                    return false;

                for ( int i = 0; i < list.Count; i++ )
                    list[i].Z = 0;

                list[iPt].Z = 1;
                sender.Refresh();

                return false;
            }

            return false;
    }