private void zedGraphControl_ContextMenuBuilder(ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState) { CopyEmfToolStripMenuItem.AddToContextMenu(sender, menuStrip); }
private bool zedGraphControl_MouseUpEvent(ZedGraphControl sender, MouseEventArgs e) { return(false); }
private bool zedGraphControl_PreMouseMoveEvent(ZedGraphControl sender, MouseEventArgs e) { double newX, newY; if (e.Button == MouseButtons.Left && _drawCurve) { int textThreshold = textBoxThreshold.Text == "" ? (int)0 : Convert.ToInt16(textBoxThreshold.Text); // only add if we've actually clicked on the pane, so make sure the mouse is over it first if (zedGraphControl.MasterPane.FindPane(e.Location) != null) { PointPairList pointList = zedGraphControl.GraphPane.CurveList[0].Points as PointPairList; zedGraphControl.GraphPane.ReverseTransform(e.Location, out newX, out newY); if (pointList.Count == 0 && _tempX < newX - 1) { pointList.Insert(0, 0, newY); } //Verify the point is in the usable bounds. if (newX > 100) { newX = 100; } else if (newX < 0) { newX = 0; } if (newY > 100) { newY = 100; } else if (newY < 0) { newY = 0; } if (_tempX < newX - textThreshold) { if (newX >= 0) { pointList.Insert(0, newX, newY); } pointList.Sort(); zedGraphControl.Invalidate(); _tempX = newX; } } } if (zedGraphControl.IsEditing) { PointPairList pointList = zedGraphControl.GraphPane.CurveList[0].Points as PointPairList; pointList.Sort(); return(false); } //Used to move Curve higher or lower on the grid or when shift is pressed will flatten curve and then move higher or lower on the grid. if (e.Button == MouseButtons.Left && !_drawCurve) { zedGraphControl.GraphPane.ReverseTransform(e.Location, out newX, out newY); if (ModifierKeys.HasFlag(Keys.Shift)) { //Verify the point is in the usable bounds. only care about the Y axis. if (newY > 100) { newY = 100; } else if (newY < 0) { newY = 0; } var points = new PointPairList(new[] { 0.0, 100.0 }, new[] { newY, newY }); PointPairList pointList = zedGraphControl.GraphPane.CurveList[0].Points as PointPairList; pointList.Clear(); pointList.Add(points); zedGraphControl.Invalidate(); txtYValue.Text = newY.ToString("0.####"); txtXValue.Text = ""; } else { if (ModifierKeys == Keys.None) { //Move curve higher or lower on the Y axis. bool stopUpdating = false; PointPairList pointList = zedGraphControl.GraphPane.CurveList[0].Points as PointPairList; //Check if any curve point extends past the Y axis. foreach (var points in pointList) { if ((points.Y >= 100 && newY > _previousCurveYLocation) || (points.Y <= 0 && newY < _previousCurveYLocation)) { double adjustedPoint = 0; if (points.Y > 100) { adjustedPoint = points.Y - 100; } if (points.Y < 0) { adjustedPoint = points.Y; } //ensures the curve remains bound by the upper and lower limits. foreach (var updatePoints in pointList) { updatePoints.Y = updatePoints.Y - adjustedPoint; } stopUpdating = true; break; } } if (!stopUpdating) { //New curve location foreach (var points in pointList) { points.Y = points.Y + (newY - _previousCurveYLocation); } } _previousCurveYLocation = newY; zedGraphControl.Invalidate(); } } } return(false); }
private bool onGraphMouseUp(ZedGraphControl sender, MouseEventArgs e) { mSelectedIndex = -1; return(true); }
private void RefreshChart(ZedGraphControl chart) { chart.GraphPane.AxisChange(); chart.Refresh(); }
public void CreateResultScatterplot(ZedGraphControl zgc, double[][] inputs, double[] expected, double[] output) { GraphPane myPane = zgc.GraphPane; myPane.CurveList.Clear(); // Set the titles myPane.Title.IsVisible = false; myPane.XAxis.Title.Text = columnNames[0]; myPane.YAxis.Title.Text = columnNames[1]; // Classification problem PointPairList list1 = new PointPairList(); // Z = 0, OK PointPairList list2 = new PointPairList(); // Z = 1, OK PointPairList list3 = new PointPairList(); // Z = 0, Error PointPairList list4 = new PointPairList(); // Z = 1, Error for (int i = 0; i < output.Length; i++) { if (output[i] == 0) { if (expected[i] == 0) { list1.Add(inputs[i][0], inputs[i][1]); } if (expected[i] == 1) { list3.Add(inputs[i][0], inputs[i][1]); } } else { if (expected[i] == 0) { list4.Add(inputs[i][0], inputs[i][1]); } if (expected[i] == 1) { list2.Add(inputs[i][0], inputs[i][1]); } } } // Add the curve LineItem myCurve = myPane.AddCurve("G1 Hits", list1, Color.Blue, SymbolType.Diamond); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Blue); myCurve = myPane.AddCurve("G2 Hits", list2, Color.Green, SymbolType.Diamond); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Green); myCurve = myPane.AddCurve("G1 Miss", list3, Color.Blue, SymbolType.Plus); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = true; myCurve.Symbol.Fill = new Fill(Color.Blue); myCurve = myPane.AddCurve("G2 Miss", list4, Color.Green, SymbolType.Plus); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = true; myCurve.Symbol.Fill = new Fill(Color.Green); // Fill the chart panel background color myPane.Fill = new Fill(Color.WhiteSmoke); zgc.AxisChange(); zgc.Invalidate(); }
private bool zedGraphMins_MouseUpEvent(ZedGraphControl sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { //Выход, если событие не от "Левой" кн. return(true); } object obj; PointF p = new PointF(e.X, e.Y); bool found; int index; //Поиск объекта found = sender.GraphPane.FindNearestObject(p, CreateGraphics(), out obj, out index); if (!(obj is BarItem) && !(obj is LineItem)) { //Выход, если объект не "требуемого" типа return(true); } if (m_tecView.currHour == true) { if (!(m_tecView.lastMin > index + 1)) { //Выход, если выбранный объект находится "в будущем" return(true); } else { ; } } else { ; } if (found == true) { //Пересчет, перерисовка панели с оперативной информацией с "выбранным" 3-х мин интервалом lock (m_tecView.m_lockValue) { int prevLastMin = m_tecView.lastMin; m_tecView.recalcAver = true; m_tecView.lastMin = index + 2; m_tecView.GetRetroMinTMGen(); _pnlQuickData.ShowFactValues(); //m_tecView.recalcAver = true; //???Отработка запроса происходит при восстановленном значении... //m_tecView.lastMin = prevLastMin; if (m_tecView.currHour == false) { setRetroTickTime(m_tecView.lastHour, (index + 1) * m_tecView.GetIntervalOfTypeSourceData(ASUTP.Core.HDateTime.INTERVAL.MINUTES)); } else { ; } } } else { ; } return(true); }
public ZedGraphProfiles(ZedGraphControl zgcGraph) { this.zgcGraph = zgcGraph; ZedGraphicExtension.InitGraph(zgcGraph, "Theoretical Isotopic", "Isotopic Position", "Abundance Percentage", true, 0.0); }
public Bitmap RealtimeBackInfoStat_TeacherGraphPrint(string getDept, PanelControl pControl) { using (RealtimeInfo_TeacherDataAccess realTimeInfo_TeacherDataAccess = new RealtimeInfo_TeacherDataAccess()) { try { DataSet dsDutyID = realTimeInfo_TeacherDataAccess.GetDutyID(DateTime.Now.ToString("HH:mm:ss")); int teaAttOnTimeNumbersInDuty = 0; int teaAttNotOnTimeNumbersInDuty = 0; int teaLeaveOnTimeNumbersInDuty = 0; int teaLeaveNotOnTimeNumbersInDuty = 0; int teaShouldLeaveInDuty = 0; if (dsDutyID.Tables[0].Rows.Count > 0) { foreach (DataRow dutyRow in dsDutyID.Tables[0].Rows) { //teaAttNumbersInDuty += realTimeInfo_TeacherDataAccess.GetTeaNumbers(DateTime.Now.DayOfWeek.ToString(),dutyRow[0].ToString(),getDept); realTimeInfo_TeacherDataAccess.GetTeaWorkingNumbers(dutyRow[0].ToString(), ref teaAttOnTimeNumbersInDuty, ref teaAttNotOnTimeNumbersInDuty, getDept, DateTime.Now.Date); realTimeInfo_TeacherDataAccess.GetTeaLeaveNumbers(dutyRow[0].ToString(), ref teaLeaveOnTimeNumbersInDuty, ref teaLeaveNotOnTimeNumbersInDuty, getDept, DateTime.Now.Date); } } int noDutyTotal = 0; int noDutyAttend = 0; int noDutyLeave = 0; realTimeInfo_TeacherDataAccess.GetTeacherRealTimeInfoWithNoDuty(getDept, DateTime.Now.DayOfWeek.ToString(), ref noDutyTotal, ref noDutyAttend, ref noDutyLeave); teaLeaveOnTimeNumbersInDuty += noDutyLeave; teaShouldLeaveInDuty = teaAttOnTimeNumbersInDuty + teaAttNotOnTimeNumbersInDuty + noDutyAttend; double onTimePer = (double)teaLeaveOnTimeNumbersInDuty / (double)teaShouldLeaveInDuty; double notOnTimePer = (double)teaLeaveNotOnTimeNumbersInDuty / (double)teaShouldLeaveInDuty; double remainPer = 1 - (((double)teaLeaveOnTimeNumbersInDuty + (double)teaLeaveNotOnTimeNumbersInDuty) / (double)teaShouldLeaveInDuty); zedGraph_RealtimeMorningInfoStatTeacher = new ZedGraphControl(); pControl.Controls.Clear(); pControl.Controls.Add(zedGraph_RealtimeMorningInfoStatTeacher); zedGraph_RealtimeMorningInfoStatTeacher.Dock = DockStyle.Fill; GraphPane myPane = zedGraph_RealtimeMorningInfoStatTeacher.GraphPane; if (getDept.Equals("")) { myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() + "全体教职工下班情况实时统计图\n" + "统计日期: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } else { myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() + getDept + "部教师下班情况实时统计图\n" + "统计日期: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } double[] statusVal = { onTimePer, notOnTimePer, remainPer }; string[] statusLabel = { "离开", "早退", "剩余" }; myPane.PaneFill = new Fill(Color.Cornsilk); myPane.AxisFill = new Fill(Color.Cornsilk); myPane.Legend.Position = LegendPos.Right; myPane.Legend.FontSpec.Size = 12; PieItem [] slices = new PieItem[statusVal.Length]; slices = myPane.AddPieSlices(statusVal, statusLabel); ((PieItem)slices[0]).LabelType = PieLabelType.Percent; ((PieItem)slices[0]).LabelDetail.FontSpec.Size = 14; ((PieItem)slices[1]).LabelType = PieLabelType.Percent; ((PieItem)slices[1]).LabelDetail.FontSpec.Size = 14; ((PieItem)slices[2]).LabelType = PieLabelType.Percent; ((PieItem)slices[2]).LabelDetail.FontSpec.Size = 14; ((PieItem)slices[1]).Displacement = .1; BoxItem box = new BoxItem(new RectangleF(0F, 0F, 1F, 1F), Color.Empty, Color.PeachPuff); box.Location.CoordinateFrame = CoordType.AxisFraction; box.Border.IsVisible = false; box.Location.AlignH = AlignH.Left; box.Location.AlignV = AlignV.Top; box.ZOrder = ZOrder.E_BehindAxis; myPane.GraphItemList.Add(box); zedGraph_RealtimeMorningInfoStatTeacher.IsShowContextMenu = false; zedGraph_RealtimeMorningInfoStatTeacher.IsEnableZoom = false; zedGraph_RealtimeMorningInfoStatTeacher.AxisChange(); return(myPane.Image); } catch (Exception e) { Util.WriteLog(e.Message, Util.EXCEPTION_LOG_TITLE); return(null); } } }
//显示点 private string MyPointValueHandler(ZedGraphControl control, GraphPane pane, CurveItem curve, int iPt) { PointPair pt = curve[iPt]; return(curve.Label.Text.Substring(0, 4) + ": " + pt.Y.ToString() + " " + curve.Label.Text.Substring(4, curve.Label.Text.Length - 4) + " " + XDate.XLDateToDateTime(pt.X).ToString()); }
private string MyPointValueHandler(ZedGraphControl aSender, GraphPane aPane, CurveItem aCurve, int aIpt) { return("111"); }
public ZedGraphIndividualScan(ZedGraphControl zgcGraph) { this.zgcGraph = zgcGraph; ZedGraphicExtension.InitGraph(zgcGraph, "Experimental Envelope", "m/z", "Intensity", false, 0.05); }
private string zedGraphControl_PointValueEvent(ZedGraphControl sender, GraphPane pane, CurveItem curve, int iPt) { return(String.Format("{0} hz/{1} rpm", curve[iPt].X, curve[iPt].X * 60.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; }
/// <summary> /// Setup 'graph' to look like a SportTracks chart. /// </summary> /// <param name="visualTheme">Theme to apply</param> /// <param name="graph">ZedChart that we're masquerading as a SportTracks chart</param> internal static void zedThemeChanged(ITheme visualTheme, ZedGraphControl graph) { GraphPane myPane = graph.GraphPane; // Overall appearance settings graph.BorderStyle = BorderStyle.None; myPane.Legend.IsVisible = false; myPane.Border.IsVisible = false; myPane.Title.IsVisible = false; // Add a background color myPane.Fill.Color = visualTheme.Window; myPane.Chart.Fill = new Fill(visualTheme.Window); myPane.Chart.Border.IsVisible = false; // Add gridlines to the plot, and make them gray myPane.XAxis.MajorGrid.IsVisible = true; myPane.YAxis.MajorGrid.IsVisible = true; myPane.XAxis.MajorGrid.Color = Color.DarkGray; myPane.YAxis.MajorGrid.Color = myPane.XAxis.MajorGrid.Color; myPane.XAxis.MajorGrid.DashOff = 1f; myPane.XAxis.MajorGrid.DashOff = myPane.XAxis.MajorGrid.DashOn; myPane.YAxis.MajorGrid.DashOff = myPane.XAxis.MajorGrid.DashOn; myPane.YAxis.MajorGrid.DashOff = myPane.YAxis.MajorGrid.DashOn; myPane.XAxis.IsAxisSegmentVisible = true; myPane.YAxis.IsAxisSegmentVisible = true; // Update axis Tic marks myPane.XAxis.MinorTic.IsAllTics = false; myPane.XAxis.MajorTic.IsAllTics = false; myPane.YAxis.MinorTic.IsAllTics = false; myPane.YAxis.MajorTic.IsAllTics = false; myPane.XAxis.MajorTic.IsOutside = true; myPane.YAxis.MajorTic.IsOutside = true; // Setup Text Appearance string fontName = "Microsoft Sans Sarif"; myPane.IsFontsScaled = false; myPane.XAxis.Title.FontSpec.Family = fontName; myPane.XAxis.Title.FontSpec.IsBold = true; myPane.XAxis.Scale.FontSpec.Family = fontName; myPane.XAxis.Scale.IsUseTenPower = false; Color mainCurveColor; if (myPane.CurveList.Count > 0) { mainCurveColor = myPane.CurveList[0].Color; } else { mainCurveColor = Color.Black; } myPane.YAxis.Title.FontSpec.Family = fontName; myPane.YAxis.Title.FontSpec.IsBold = true; myPane.YAxis.Title.FontSpec.FontColor = mainCurveColor; myPane.YAxis.Scale.FontSpec.FontColor = mainCurveColor; myPane.YAxis.Scale.FontSpec.Family = fontName; graph.Refresh(); }
private void BUT_log2_Click(object sender, EventArgs e) { Utilities.FFT2 fft = new FFT2(); using ( OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "*.log|*.log"; ofd.ShowDialog(); if (!File.Exists(ofd.FileName)) { return; } var file = new StreamReader(File.OpenRead(ofd.FileName)); int bins = (int)NUM_bins.Value; int N = 1 << bins; Color[] color = new Color[] { Color.Red, Color.Green, Color.Blue, Color.Black, Color.Violet, Color.Orange }; ZedGraphControl[] ctls = new ZedGraphControl[] { zedGraphControl1, zedGraphControl2, zedGraphControl3, zedGraphControl4, zedGraphControl5, zedGraphControl6 }; // 3 imus * 2 sets of measurements(gyr/acc) datastate[] alldata = new datastate[3 * 2]; for (int a = 0; a < alldata.Length; a++) { alldata[a] = new datastate(); } Log.DFLog dflog = new Log.DFLog(); while (!file.EndOfStream) { var item = dflog.GetDFItemFromLine(file.ReadLine(), 0); if (item.msgtype == null) { continue; } if (item.msgtype.StartsWith("ACC")) { int sensorno = int.Parse(item.msgtype.Substring(3)) - 1 + 3; alldata[sensorno].type = item.msgtype; int offsetAX = dflog.FindMessageOffset(item.msgtype, "AccX"); int offsetAY = dflog.FindMessageOffset(item.msgtype, "AccY"); int offsetAZ = dflog.FindMessageOffset(item.msgtype, "AccZ"); int offsetTime = dflog.FindMessageOffset(item.msgtype, "TimeUS"); double time = double.Parse(item.items[offsetTime]) / 1000.0; if (time != alldata[sensorno].lasttime) { alldata[sensorno].timedelta = alldata[sensorno].timedelta * 0.99 + (time - alldata[sensorno].lasttime) * 0.01; } alldata[sensorno].lasttime = time; alldata[sensorno].datax.Add(double.Parse(item.items[offsetAX])); alldata[sensorno].datay.Add(double.Parse(item.items[offsetAY])); alldata[sensorno].dataz.Add(double.Parse(item.items[offsetAZ])); } else if (item.msgtype.StartsWith("GYR")) { int sensorno = int.Parse(item.msgtype.Substring(3)) - 1; alldata[sensorno].type = item.msgtype; int offsetGX = dflog.FindMessageOffset(item.msgtype, "GyrX"); int offsetGY = dflog.FindMessageOffset(item.msgtype, "GyrY"); int offsetGZ = dflog.FindMessageOffset(item.msgtype, "GyrZ"); int offsetTime = dflog.FindMessageOffset(item.msgtype, "TimeUS"); double time = double.Parse(item.items[offsetTime]) / 1000.0; if (time != alldata[sensorno].lasttime) { alldata[sensorno].timedelta = alldata[sensorno].timedelta * 0.99 + (time - alldata[sensorno].lasttime) * 0.01; } alldata[sensorno].lasttime = time; alldata[sensorno].datax.Add(double.Parse(item.items[offsetGX])); alldata[sensorno].datay.Add(double.Parse(item.items[offsetGY])); alldata[sensorno].dataz.Add(double.Parse(item.items[offsetGZ])); } } int controlindex = 0; foreach (var sensordata in alldata) { if (sensordata.datax.Count <= N) { continue; } double samplerate = 0; samplerate = Math.Round(1000 / sensordata.timedelta, 1); double[] freqt = fft.FreqTable(N, (int)samplerate); double[] avgx = new double[N / 2]; double[] avgy = new double[N / 2]; double[] avgz = new double[N / 2]; int totalsamples = sensordata.datax.Count; int count = totalsamples / N; int done = 0; while (count > 1) // skip last part { var fftanswerx = fft.rin(sensordata.datax.Skip(N * done).Take(N).ToArray(), (uint)bins); var fftanswery = fft.rin(sensordata.datay.Skip(N * done).Take(N).ToArray(), (uint)bins); var fftanswerz = fft.rin(sensordata.dataz.Skip(N * done).Take(N).ToArray(), (uint)bins); for (int b = 0; b < N / 2; b++) { if (freqt[b] < (double)NUM_startfreq.Value) { continue; } avgx[b] += fftanswerx[b] / (N / 2); avgy[b] += fftanswery[b] / (N / 2); avgz[b] += fftanswerz[b] / (N / 2); } count--; done++; } ZedGraph.PointPairList pplx = new ZedGraph.PointPairList(freqt, avgx); ZedGraph.PointPairList pply = new ZedGraph.PointPairList(freqt, avgy); ZedGraph.PointPairList pplz = new ZedGraph.PointPairList(freqt, avgz); var curvex = new LineItem(sensordata.type + " x", pplx, color[0], SymbolType.None); var curvey = new LineItem(sensordata.type + " y", pply, color[1], SymbolType.None); var curvez = new LineItem(sensordata.type + " z", pplz, color[2], SymbolType.None); ctls[controlindex].GraphPane.Legend.IsVisible = true; ctls[controlindex].GraphPane.XAxis.Title.Text = "Freq Hz"; ctls[controlindex].GraphPane.YAxis.Title.Text = "Amplitude"; ctls[controlindex].GraphPane.Title.Text = "FFT " + sensordata.type + " - " + Path.GetFileName(ofd.FileName) + " - " + samplerate + "hz input"; ctls[controlindex].GraphPane.CurveList.Clear(); ctls[controlindex].GraphPane.CurveList.Add(curvex); ctls[controlindex].GraphPane.CurveList.Add(curvey); ctls[controlindex].GraphPane.CurveList.Add(curvez); ctls[controlindex].Invalidate(); ctls[controlindex].AxisChange(); ctls[controlindex].GraphPane.XAxis.Scale.Max = samplerate / 2; ctls[controlindex].Refresh(); controlindex++; } } }
private void CreateFreqGraph(ZedGraphControl zgc, List <double> xData, List <double> yData, string strname) { Color color = Color.Blue; switch (ColorcomboBox.Text) { case "Blue": color = Color.Blue; break; case "Green": color = Color.Green; break; case "Beige": color = Color.Beige; break; case "Black": color = Color.Black; break; case "Brown": color = Color.Brown; break; case "Gray": color = Color.Gray; break; case "Ivory": color = Color.Ivory; break; case "Khaki": color = Color.Blue; break; case "Pink": color = Color.Pink; break; case "Purple": color = Color.Purple; break; case "Red": color = Color.Red; break; case "Silver": color = Color.Silver; break; case "Turquoise": color = Color.Turquoise; break; case "Violet": color = Color.Violet; break; case "Yellow": color = Color.Yellow; break; default: break; } double[] x = xData.ToArray(); double[] y = yData.ToArray(); double convertClkRate = 1 / (x[11] - x[10]); long convertClkrate = Convert.ToInt64(convertClkRate); int sectionLength = x.Length; Complex[] fftsamples = new Complex[sectionLength]; for (int i = 0; i < sectionLength; i++) { fftsamples[i] = y[i]; } Fourier.Forward(fftsamples, FourierOptions.NoScaling); double[] hzsample = new double[y.Length]; double[] mag = new double[y.Length]; for (int i = 0; i < fftsamples.Length / 2; i++) { mag[i] = (2.0 / sectionLength) * (Math.Sqrt(Math.Pow(fftsamples[i].Real, 2) + Math.Pow(fftsamples[i].Imaginary, 2))); hzsample[i] = convertClkRate / sectionLength * i; } GraphPane myPane = zgc.GraphPane; // Set the titles and axis labels // Make up some data points from the Sine function PointPairList list = new PointPairList(); list.Add(hzsample, mag); LineItem myCurve; // Generate a blue curve with circle symbols, and "My Curve 2" in the legend myCurve = zedGraphControl2.GraphPane.AddCurve("Freq" + strname, list, color, SymbolType.None); //myCurve = zedGraphControl2.GraphPane.AddCurve("Channel 0", hzsample, mag, Color.Red, SymbolType.None); // Make the symbols opaque by filling them with white myCurve.Line.Fill = new Fill(Color.White, color, 45F); myCurve.Symbol.Fill = new Fill(Color.White); // Fill the axis background with a color gradient zgc.AxisChange(); zgc.Refresh(); }
private bool chart1_MouseDownEvent(ZedGraphControl sender, System.Windows.Forms.MouseEventArgs e) { mouseDownLoc = e.Location; return(false); }
private void CreateTimeGraph(ZedGraphControl zgc, List <double> xData, List <double> yData, string strname) { Color color = Color.Blue; switch (ColorcomboBox.Text) { case "Blue": color = Color.Blue; break; case "Green": color = Color.Green; break; case "Beige": color = Color.Beige; break; case "Black": color = Color.Black; break; case "Brown": color = Color.Brown; break; case "Gray": color = Color.Gray; break; case "Ivory": color = Color.Ivory; break; case "Khaki": color = Color.Blue; break; case "Pink": color = Color.Pink; break; case "Purple": color = Color.Purple; break; case "Red": color = Color.Red; break; case "Silver": color = Color.Silver; break; case "Turquoise": color = Color.Turquoise; break; case "Violet": color = Color.Violet; break; case "Yellow": color = Color.Yellow; break; default: break; } GraphPane myPane = zgc.GraphPane; // Set the titles and axis labels double[] x = xData.ToArray(); double[] y = yData.ToArray(); // 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("Time" + strname, x, y, color, 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(); }
/// <summary> /// Update Cartesian graph /// </summary> /// <param name="zgc"></param> /// <param name="gPane"></param> /// <param name="graph_index"></param> private void UpdateCartesianGraph(ref ZedGraphControl zgc, ref GraphPane gPane, int graph_index) { if (gPane.GraphObjList != null) { gPane.GraphObjList.Clear(); } if (zgc.GraphPane.CurveList != null) { zgc.GraphPane.CurveList.Clear(); } int cur_index = this.panaLidar.set_parameter.cur_count; if (graph_index == 1) { if (this.xyPoint[cur_index] != null) { this.xyPoint[cur_index].Clear(); } else { this.xyPoint[cur_index] = new PointPairList(); } } if (graph_index == 2) { if (this.xzPoint[cur_index] != null) { this.xzPoint[cur_index].Clear(); } else { this.xzPoint[cur_index] = new PointPairList(); } } for (int i = 0; i < this.panaLidar.point_cloud.Count; i++) { if (graph_index == 1) { this.xyPoint[cur_index].Add(this.panaLidar.point_cloud[i].x, this.panaLidar.point_cloud[i].y); } if (graph_index == 2) { this.xzPoint[cur_index].Add(this.panaLidar.point_cloud[i].x, this.panaLidar.point_cloud[i].z); } } for (int i = 0; i < this.panaLidar.set_parameter.scan_count; i++) { string label_line = "line " + i.ToString(); if (graph_index == 1) { if (this.xyPoint[i] != null) { gPane.AddCurve(label_line, this.xyPoint[i], this.SetColor(i), SymbolType.None); } } if (graph_index == 2) { if (this.xzPoint[i] != null) { gPane.AddCurve(label_line, this.xzPoint[i], this.SetColor(i), SymbolType.None); } } } // tell zedgraph to refigure the axes since the data have changed zgc.AxisChange(); // force redraw zgc.Invalidate(); }
// Respond to a Zoom Event private void MyZoomEvent(ZedGraphControl control, ZoomState oldState, ZoomState newState) { // Here we get notification everytime the user zooms }
public void BuildChromatogramMenu(ZedGraphControl zedGraphControl, PaneKey paneKey, ContextMenuStrip menuStrip, ChromFileInfoId chromFileInfoId) { // Store original menu items in an array, and insert a separator ToolStripItem[] items = new ToolStripItem[menuStrip.Items.Count]; int iUnzoom = -1; for (int i = 0; i < items.Length; i++) { items[i] = menuStrip.Items[i]; string tag = (string)items[i].Tag; if (tag == @"unzoom") { iUnzoom = i; } } if (iUnzoom != -1) { menuStrip.Items.Insert(iUnzoom, toolStripSeparator26); } // Insert skyline specific menus var set = Settings.Default; int iInsert = 0; var settings = DocumentUI.Settings; bool retentionPredict = (settings.PeptideSettings.Prediction.RetentionTime != null); bool peptideIdTimes = (settings.PeptideSettings.Libraries.HasLibraries && (settings.TransitionSettings.FullScan.IsEnabled || settings.PeptideSettings.Libraries.HasMidasLibrary)); AddApplyRemovePeak(menuStrip, paneKey.IsotopeLabelType, 1, ref iInsert); legendChromContextMenuItem.Checked = set.ShowChromatogramLegend; menuStrip.Items.Insert(iInsert++, legendChromContextMenuItem); var fullScan = Document.Settings.TransitionSettings.FullScan; if (ChromatogramCache.FORMAT_VERSION_CACHE > ChromatogramCache.FORMAT_VERSION_CACHE_4 && fullScan.IsEnabled && (fullScan.IsHighResPrecursor || fullScan.IsHighResProduct)) { massErrorContextMenuItem.Checked = set.ShowMassError; menuStrip.Items.Insert(iInsert++, massErrorContextMenuItem); } peakBoundariesContextMenuItem.Checked = set.ShowPeakBoundaries; menuStrip.Items.Insert(iInsert++, peakBoundariesContextMenuItem); originalPeakMenuItem.Checked = set.ShowOriginalPeak; menuStrip.Items.Insert(iInsert++, originalPeakMenuItem); menuStrip.Items.Insert(iInsert++, retentionTimesContextMenuItem); if (retentionTimesContextMenuItem.DropDownItems.Count == 0) { retentionTimesContextMenuItem.DropDownItems.AddRange(new ToolStripItem[] { allRTContextMenuItem, bestRTContextMenuItem, thresholdRTContextMenuItem, noneRTContextMenuItem, rawTimesMenuItemSplitter, rawTimesContextMenuItem }); } if (retentionPredict) { retentionTimePredContextMenuItem.Checked = set.ShowRetentionTimePred; menuStrip.Items.Insert(iInsert++, retentionTimePredContextMenuItem); } rawTimesContextMenuItem.Checked = set.ChromShowRawTimes; bool alignedTimes = settings.HasAlignedTimes(); bool unalignedTimes = settings.HasUnalignedTimes(); if (peptideIdTimes || alignedTimes || unalignedTimes) { menuStrip.Items.Insert(iInsert++, peptideIDTimesContextMenuItem); peptideIDTimesContextMenuItem.DropDownItems.Clear(); idTimesNoneContextMenuItem.Checked = false; peptideIDTimesContextMenuItem.DropDownItems.Add(idTimesNoneContextMenuItem); if (peptideIdTimes) { idTimesMatchingContextMenuItem.Checked = set.ShowPeptideIdTimes; peptideIDTimesContextMenuItem.DropDownItems.Add(idTimesMatchingContextMenuItem); } if (settings.HasAlignedTimes()) { idTimesAlignedContextMenuItem.Checked = set.ShowAlignedPeptideIdTimes; peptideIDTimesContextMenuItem.DropDownItems.Add(idTimesAlignedContextMenuItem); } if (settings.HasUnalignedTimes()) { idTimesOtherContextMenuItem.Checked = set.ShowUnalignedPeptideIdTimes; peptideIDTimesContextMenuItem.DropDownItems.Add(idTimesOtherContextMenuItem); } idTimesNoneContextMenuItem.Checked = !peptideIDTimesContextMenuItem.DropDownItems .Cast <ToolStripMenuItem>() .Any(idItem => idItem.Checked); } menuStrip.Items.Insert(iInsert++, toolStripSeparator16); AddTransitionContextMenu(menuStrip, iInsert++); menuStrip.Items.Insert(iInsert++, transformChromContextMenuItem); // Sometimes child menuitems are stripped from the parent if (transformChromContextMenuItem.DropDownItems.Count == 0) { transformChromContextMenuItem.DropDownItems.AddRange(new ToolStripItem[] { transformChromNoneContextMenuItem, transformChromInterpolatedContextMenuItem, secondDerivativeContextMenuItem, firstDerivativeContextMenuItem, smoothSGChromContextMenuItem }); } menuStrip.Items.Insert(iInsert++, toolStripSeparator17); menuStrip.Items.Insert(iInsert++, autoZoomContextMenuItem); // Sometimes child menuitems are stripped from the parent if (autoZoomContextMenuItem.DropDownItems.Count == 0) { autoZoomContextMenuItem.DropDownItems.AddRange(new ToolStripItem[] { autoZoomNoneContextMenuItem, autoZoomBestPeakContextMenuItem, autoZoomRTWindowContextMenuItem, autoZoomBothContextMenuItem }); } lockYChromContextMenuItem.Checked = set.LockYChrom; menuStrip.Items.Insert(iInsert++, lockYChromContextMenuItem); synchronizeZoomingContextMenuItem.Checked = set.AutoZoomAllChromatograms; menuStrip.Items.Insert(iInsert++, synchronizeZoomingContextMenuItem); iInsert = InsertAlignmentMenuItems(menuStrip.Items, chromFileInfoId, iInsert); menuStrip.Items.Insert(iInsert++, toolStripSeparator18); menuStrip.Items.Insert(iInsert++, chromPropsContextMenuItem); menuStrip.Items.Insert(iInsert, toolStripSeparator19); // Remove some ZedGraph menu items not of interest foreach (var item in items) { string tag = (string)item.Tag; if (tag == @"set_default" || tag == @"show_val") { menuStrip.Items.Remove(item); } } CopyEmfToolStripMenuItem.AddToContextMenu(zedGraphControl, menuStrip); }
void zg_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState) { _autoScrollSize = null; }
private bool zedGraphControl_MouseDownEvent(ZedGraphControl sender, MouseEventArgs e) { if (ReadonlyCurve) { return(false); } CurveItem curve; int dragPointIndex; // if CTRL is pressed, and we're not near a specific point, add a new point double newX, newY; if (Control.ModifierKeys.HasFlag(Keys.Control) && !zedGraphControl.GraphPane.FindNearestPoint(e.Location, out curve, out dragPointIndex)) { // only add if we've actually clicked on the pane, so make sure the mouse is over it first if (zedGraphControl.MasterPane.FindPane(e.Location) != null) { PointPairList pointList = zedGraphControl.GraphPane.CurveList[0].Points as PointPairList; zedGraphControl.GraphPane.ReverseTransform(e.Location, out newX, out newY); //Verify the point is in the usable bounds. if (newX > 100) { newX = 100; } else if (newX < 0) { newX = 0; } if (newY > 100) { newY = 100; } else if (newY < 0) { newY = 0; } pointList.Insert(0, newX, newY); pointList.Sort(); zedGraphControl.Invalidate(); } } // if the ALT key was pressed, and we're near a point, delete it -- but only if there would be at least two points left if (Control.ModifierKeys.HasFlag(Keys.Alt) && zedGraphControl.GraphPane.FindNearestPoint(e.Location, out curve, out dragPointIndex)) { PointPairList pointList = zedGraphControl.GraphPane.CurveList[0].Points as PointPairList; if (pointList.Count > 2) { pointList.RemoveAt(dragPointIndex); pointList.Sort(); zedGraphControl.Invalidate(); } } zedGraphControl.GraphPane.ReverseTransform(e.Location, out newX, out newY); _previousCurveYLocation = newY; if (!Curve.IsLibraryReference && e.Button == MouseButtons.Left && sender.DragEditingPair != null && !ModifierKeys.HasFlag(Keys.Shift)) { txtXValue.Text = sender.DragEditingPair.X.ToString("0.####"); txtYValue.Text = sender.DragEditingPair.Y.ToString("0.####"); txtXValue.Enabled = txtYValue.Enabled = btnUpdateCoordinates.Enabled = true; } return(false); }
void zg_ContextMenuBuilder(ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState) { for (int i = 0; i < menuStrip.Items.Count; i++) { if ((string)menuStrip.Items[i].Tag == "unzoom" || (string)menuStrip.Items[i].Tag == "undo_all" || (string)menuStrip.Items[i].Tag == "show_val") { menuStrip.Items.RemoveAt(i); i--; } else if ((string)menuStrip.Items[i].Tag == "default") { menuStrip.Items[i].Text = "Zoom Out"; } } _offsetOption = new ToolStripMenuItem(); _offsetOption.Text = "Toggle Comparison Mode"; _offsetOption.Name = "offsetOption"; _offsetOption.Tag = "offset"; _offsetOption.Click += new EventHandler(offsetOption_Click); menuStrip.Items.Add(_offsetOption); _showKeyOption = new ToolStripMenuItem(); _showKeyOption.Text = "Show/Hide Legend"; _showKeyOption.Name = "showKey"; _showKeyOption.Tag = "showKey"; _showKeyOption.Click += new EventHandler(_showKeyOption_Click); menuStrip.Items.Add(_showKeyOption); ToolStripMenuItem autoScrollMenu = new ToolStripMenuItem(); autoScrollMenu.Text = "Auto Scroll"; autoScrollMenu.Name = "autoScroll"; autoScrollMenu.Tag = "autoScroll"; ToolStripMenuItem autoScroll30 = new ToolStripMenuItem(); autoScroll30.Text = "30s"; autoScroll30.Name = "autoScroll30"; autoScroll30.Tag = "autoScroll30"; autoScroll30.Click += new EventHandler(autoScroll_Click); autoScrollMenu.DropDownItems.Add(autoScroll30); ToolStripMenuItem autoScroll60 = new ToolStripMenuItem(); autoScroll60.Text = "1m"; autoScroll60.Name = "autoScroll60"; autoScroll60.Tag = "autoScroll60"; autoScroll60.Click += new EventHandler(autoScroll_Click); autoScrollMenu.DropDownItems.Add(autoScroll60); ToolStripMenuItem autoScroll120 = new ToolStripMenuItem(); autoScroll120.Text = "2m"; autoScroll120.Name = "autoScroll120"; autoScroll120.Tag = "autoScroll120"; autoScroll120.Click += new EventHandler(autoScroll_Click); autoScrollMenu.DropDownItems.Add(autoScroll120); ToolStripMenuItem autoScroll300 = new ToolStripMenuItem(); autoScroll300.Text = "5m"; autoScroll300.Name = "autoScroll300"; autoScroll300.Tag = "autoScroll300"; autoScroll300.Click += new EventHandler(autoScroll_Click); autoScrollMenu.DropDownItems.Add(autoScroll300); ToolStripMenuItem autoScroll0 = new ToolStripMenuItem(); autoScroll0.Text = "All"; autoScroll0.Name = "autoScroll0"; autoScroll0.Tag = "autoScroll0"; autoScroll0.Click += new EventHandler(autoScroll_Click); autoScrollMenu.DropDownItems.Add(autoScroll0); menuStrip.Items.Add(autoScrollMenu); }
private void graph_ContextMenuBuilder(ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState) { menuStrip.Items.Insert(2, CreateExportMenuItem()); menuStrip.Items.Add(scaleMenu); }
public FragmentationStatisticsForm(IDPickerForm owner) { InitializeComponent(); this.owner = owner; FormClosing += delegate(object sender, FormClosingEventArgs e) { e.Cancel = true; DockState = DockState.DockBottomAutoHide; }; Text = TabText = "Fragmentation Statistics"; Icon = Properties.Resources.BlankIcon; refreshButton.Image = new Icon(Properties.Resources.Refresh, refreshButton.Width / 2, refreshButton.Height / 2).ToBitmap(); refreshDataLabel.LinkClicked += (sender, e) => refreshButton_Click(sender, e); percentTicGraphForm = new DockableForm { Text = "%TIC" }; percentPeakCountGraphForm = new DockableForm { Text = "%PeakCount" }; meanMzErrorGraphForm = new DockableForm { Text = "Mean m/z error" }; percentTicGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = percentTicGraphForm.Text }; percentPeakCountGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = percentPeakCountGraphForm.Text }; meanMzErrorGraphControl = new ZedGraphControl { Dock = DockStyle.Fill, Text = meanMzErrorGraphForm.Text }; percentTicGraphForm.Controls.Add(percentTicGraphControl); percentPeakCountGraphForm.Controls.Add(percentPeakCountGraphControl); meanMzErrorGraphForm.Controls.Add(meanMzErrorGraphControl); initializeGraphControl(percentTicGraphControl); initializeGraphControl(percentPeakCountGraphControl); initializeGraphControl(meanMzErrorGraphControl); lastActiveGraphForm = meanMzErrorGraphForm; graphControls = new List <ZedGraphControl> { percentTicGraphControl, percentPeakCountGraphControl, meanMzErrorGraphControl }; percentTicGraphForm.FormClosing += (sender, e) => e.Cancel = true; percentPeakCountGraphForm.FormClosing += (sender, e) => e.Cancel = true; meanMzErrorGraphForm.FormClosing += (sender, e) => e.Cancel = true; fragmentTolerance = new MZTolerance(0.5, MZTolerance.Units.MZ); fragmentToleranceUnitsComboBox.Text = fragmentTolerance.value.ToString(); fragmentToleranceUnitsComboBox.SelectedIndex = (int)fragmentTolerance.units; }
public ZGraph(ref ZedGraphControl zedgraph) { this.zedgraph = zedgraph; }
private void initializeGraphControl(ZedGraphControl zedGraphControl) { zedGraphControl.MasterPane.PaneList.Clear(); zedGraphControl.MasterPane.SetLayout(zedGraphControl.CreateGraphics(), 1, (int)IonSeries.Count + 1); zedGraphControl.MasterPane.InnerPaneGap = 0; zedGraphControl.MasterPane.Border.IsVisible = true; zedGraphControl.IsEnableHPan = false; zedGraphControl.IsEnableHZoom = false; zedGraphControl.IsSynchronizeYAxes = true; zedGraphControl.IsZoomOnMouseCenter = true; var axisPane = new GraphPane(); axisPane.Legend.IsVisible = false; axisPane.IsFontsScaled = false; axisPane.XAxis.IsVisible = false; axisPane.YAxis.Scale.Min = 0; axisPane.YAxis.Scale.Max = 100; axisPane.YAxis.Title.Text = zedGraphControl.Text; axisPane.YAxis.Title.Gap = 0.05f; axisPane.YAxis.MajorTic.IsOpposite = false; axisPane.YAxis.MinorTic.IsOpposite = false; axisPane.Chart.Border.IsVisible = false; axisPane.Border.IsVisible = false; axisPane.Margin.Left = 1; axisPane.Margin.Right = 0; axisPane.Title.Text = "Series:"; zedGraphControl.MasterPane.Add(axisPane); var csr = new ColorSymbolRotator(); for (int i = 0; i < (int)IonSeries.Count; ++i) { var graphPane = new GraphPane(); graphPane.Title.Text = IonSeriesLabels[i]; graphPane.Legend.IsVisible = false; graphPane.IsFontsScaled = false; graphPane.Chart.Border.IsVisible = false; graphPane.Border.IsVisible = false; graphPane.XAxis.Scale.Min = -1; graphPane.XAxis.Scale.Max = 1; graphPane.XAxis.IsVisible = false; graphPane.YAxis.Scale.Min = 0; graphPane.YAxis.Scale.Max = 100; graphPane.YAxis.IsVisible = false; zedGraphControl.MasterPane.Add(graphPane); graphPane.BarSettings.Type = BarType.Overlay; graphPane.BarSettings.ClusterScaleWidth = 1; var mean = graphPane.AddCurve(IonSeriesLabels[i], new PointPairList(), Color.Black, SymbolType.Circle); mean.Line.IsVisible = false; mean.Symbol.Border.IsVisible = false; mean.Symbol.Fill.Type = FillType.Solid; var errorBar = graphPane.AddErrorBar(IonSeriesLabels[i], new PointPairList(), Color.Black); errorBar.Bar.IsVisible = true; errorBar.Bar.PenWidth = .1f; errorBar.Bar.Symbol.IsVisible = true; errorBar.Bar.Symbol.Type = SymbolType.HDash; errorBar.Bar.Symbol.Border.Width = .1f; errorBar.Bar.Symbol.Size = 4; var hiLowBar = graphPane.AddHiLowBar(IonSeriesLabels[i], new PointPairList(), Color.Black); hiLowBar.Bar.Fill.Type = FillType.None; var scatter = graphPane.AddCurve(IonSeriesLabels[i], new PointPairList(), csr.NextColor, SymbolType.Circle); scatter.Line.IsVisible = false; scatter.Symbol.IsAntiAlias = true; scatter.Symbol.Border.IsVisible = false; scatter.Symbol.Fill.Type = FillType.Solid; scatter.Symbol.Size = 3f; } zedGraphControl.MasterPane.AxisChange(); zedGraphControl.Refresh(); }
public void CreateScatterplot(ZedGraphControl zgc, double[][] graph) { GraphPane myPane = zgc.GraphPane; myPane.CurveList.Clear(); // Set the titles myPane.Title.Text = "Scatter Plot"; myPane.XAxis.Title.Text = "X"; myPane.YAxis.Title.Text = "Y"; PointPairList list1 = new PointPairList(); PointPairList list2 = new PointPairList(); PointPairList list3 = new PointPairList(); for (int i = 0; i < graph.GetLength(0); i++) { double x = graph[i][0], y = graph[i][1], z = graph[i][2]; if (z == 1.0) { list1.Add(x, y); } if (z == 2.0) { list2.Add(x, y); } if (z == 3.0) { list3.Add(x, y); } } // Add the curve LineItem myCurve = myPane.AddCurve("G1", list1, Color.Blue, SymbolType.Diamond); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Blue); myCurve = myPane.AddCurve("G2", list2, Color.Green, SymbolType.Diamond); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Green); myCurve = myPane.AddCurve("G3", list3, Color.Orange, SymbolType.Diamond); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Orange); myCurve = myPane.AddCurve("M", new PointPairList(), Color.Black, SymbolType.Diamond); myCurve.Line.IsVisible = false; myCurve.Symbol.Border.IsVisible = false; myCurve.Symbol.Fill = new Fill(Color.Black); // Fill the background of the chart rect and pane //myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f); //myPane.Fill = new Fill(Color.White, Color.SlateGray, 45.0f); myPane.Fill = new Fill(Color.WhiteSmoke); zgc.AxisChange(); zgc.Invalidate(); }
private void CreateGraph() { int count = dgvDSG.SelectedRows.Count; string[] hr = new string[count]; string[] sp = new string[count]; string[] cd = new string[count]; string[] al = new string[count]; string[] po = new string[count]; int i = 0; foreach (DataGridViewRow row in dgvDSG.SelectedRows) { hr[i] = row.Cells[1].Value.ToString(); sp[i] = row.Cells[2].Value.ToString(); cd[i] = row.Cells[3].Value.ToString(); al[i] = row.Cells[4].Value.ToString(); po[i] = row.Cells[5].Value.ToString(); i++; } PointPairList hrPairList = new PointPairList(); PointPairList spPairList = new PointPairList(); PointPairList cdPairList = new PointPairList(); PointPairList alPairList = new PointPairList(); PointPairList poPairList = new PointPairList(); for (int j = 0; j < count; j++) { hrPairList.Add(j, Double.Parse(hr[j])); spPairList.Add(j, Double.Parse(sp[j])); cdPairList.Add(j, Double.Parse(cd[j])); alPairList.Add(j, Double.Parse(al[j])); poPairList.Add(j, Double.Parse(po[j])); } ZedGraphControl zedGraph = zedGraphControlDSG; GraphPane mypane = zedGraph.GraphPane; mypane.CurveList.Clear(); mypane.Title.Text = "Cycle Analysis Software Graph"; mypane.XAxis.Title.Text = "No. Of Data"; mypane.YAxis.Title.Text = "Rate"; mypane.XAxis.Scale.Min = 0; mypane.XAxis.Scale.Max = count; myCurve1 = mypane.AddCurve("heart rate", hrPairList, Color.Red); myCurve2 = mypane.AddCurve("Speed", spPairList, Color.Blue); myCurve3 = mypane.AddCurve("Cadence", cdPairList, Color.Green); myCurve4 = mypane.AddCurve("Altitude", alPairList, Color.Yellow); myCurve5 = mypane.AddCurve("Power", poPairList, Color.Purple); zedGraph.AxisChange(); zedGraph.Invalidate(); //Loading Max Min Data on Labels SetMaxMinOnSelect(); }
private bool zedGraphControl1_MouseMoveEvent( ZedGraphControl sender, MouseEventArgs e ) { // Save the mouse location PointF mousePt = new PointF( e.X, e.Y ); // Find the Chart rect that contains the current mouse location GraphPane pane = sender.MasterPane.FindChartRect( mousePt ); // If pane is non-null, we have a valid location. Otherwise, the mouse is not // within any chart rect. if ( pane != null ) { double x, y, y2; // Convert the mouse location to X, Y, and Y2 scale values pane.ReverseTransform( mousePt, out x, out y, out y2 ); // Format the status label text toolStripStatusXY.Text = "(" + x.ToString( "f2" ) + ", " + y.ToString( "f2" ) + ")"; } else // If there is no valid data, then clear the status label text toolStripStatusXY.Text = string.Empty; // Return false to indicate we have not processed the MouseMoveEvent // ZedGraphControl should still go ahead and handle it return false; }
private bool zGraph_MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e) { double x, y; zGraph.GraphPane.ReverseTransform(e.Location, out x, out y); if (zGraph.GraphPane.CurveList.Count > 0) { for (int curveCount = 0; curveCount < zGraph.GraphPane.CurveList.Count; curveCount++) { for (int i = 0; i < zGraph.GraphPane.CurveList[curveCount].Points.Count; i++) { if (zGraph.GraphPane.CurveList[curveCount].Points[i].X == (int)x) { double time = zGraph.GraphPane.CurveList[curveCount].Points[i].X; lbTimeValue.Text = string.Format("{0}:{1}", (int)(time / 60), (time % 60).ToString("00")); switch (zGraph.GraphPane.CurveList[curveCount].Label.Text) { case "H2": lbH2Value.Text = (zGraph.GraphPane.CurveList[curveCount].Points[i].Y / Zoom).ToString(); break; case "O2": lbO2Value.Text = (zGraph.GraphPane.CurveList[curveCount].Points[i].Y / Zoom).ToString(); break; case "CO": lbCOValue.Text = (zGraph.GraphPane.CurveList[curveCount].Points[i].Y / Zoom).ToString(); break; case "CO2": lbCO2Value.Text = (zGraph.GraphPane.CurveList[curveCount].Points[i].Y / Zoom).ToString(); break; case "N2": lbN2Value.Text = (zGraph.GraphPane.CurveList[curveCount].Points[i].Y / Zoom).ToString(); break; case "Ar": lbArValue.Text = (zGraph.GraphPane.CurveList[curveCount].Points[i].Y / Zoom).ToString(); break; case "Фурма": lbLanceValue.Text = (zGraph.GraphPane.CurveList[curveCount].Points[i].Y).ToString(); break; case "OFlow": lbOFlowValue.Text = (zGraph.GraphPane.CurveList[curveCount].Points[i].Y).ToString(); break; } } } } } return default(bool); }