public static bool AddCustomSnapshot( Chart TimeLineChart, CursorEventArgs Event ) { if( TimeLineChart.Series["Allocated Memory"].Points.Count == 0 ) { return false; } else { VerticalLineAnnotation A = new VerticalLineAnnotation(); A.AxisX = Event.Axis; A.AnchorX = ( int )Event.NewSelectionStart + 1; A.ToolTip = "Snapshot"; A.IsInfinitive = true; TimeLineChart.Annotations.Add( A ); return true; } }
private void Chart1_SelectionRangeChanged(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { if (!HasSelection1()) { firstSelectedResearch = null; } }
void firstChart_CursorPositionChanged(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { selectedMin = Math.Min(yChart.ChartAreas[0].CursorX.SelectionStart, yChart.ChartAreas[0].CursorX.SelectionEnd); selectedMax = Math.Max(yChart.ChartAreas[0].CursorX.SelectionStart, yChart.ChartAreas[0].CursorX.SelectionEnd); SetAllSelectionsFromYChartSelection(); RebuildXYCharts(); }
private void OnPerformanceCursorPositionChanged(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { if (chPerformance.Series.Count > 0 && currentRecords.Count > 0) { var index = currentRecords.FindIndex(p => p.Value16.ToOADate() >= e.NewPosition); if (lastPointIndex != index && index >= 0) { lastPointIndex = index; SetPerformanceInfo(); } System.Diagnostics.Debug.WriteLine(e.NewPosition); } }
/** * Single clicking in the graph will change the summary to be the current frame. */ private void NetworkChart_CursorPositionChanged(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { CurrentFrame = (int)e.NewPosition; if (CurrentNetworkStream != null && CurrentFrame >= 0 && CurrentFrame < CurrentNetworkStream.Frames.Count) { // Cancel range select so we stop highlighting that on the chart (there will be the red line now showing the single frame selection) RangeSelectStart = -1; RangeSelectEnd = -1; // Force chart repaint NetworkChart.Invalidate(); SetCurrentStreamSelection(CurrentNetworkStream, CurrentNetworkStream.Frames[CurrentFrame].Filter(CurrentFilterValues), true); } }
/// <summary> /// Cursor changed event of scope view /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataIn_CursorPositionChanged(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { ushort index = (ushort)((dataIn.ChartAreas["ChartArea1"].CursorX.Position) / //find index of chart data point closest to cursor position (dataIn.ChartAreas["ChartArea1"].CursorX.Interval)); string xString = ""; string yString = ""; if (dataIn.Series[0].Points.Count >= index) { double x = dataIn.Series[0].Points[index].XValue; double y = dataIn.Series[0].Points[index].YValues[0]; dataIn.ChartAreas["ChartArea1"].CursorY.Position = y; if (x < 1E-3) { xString = $"{(x * 1E6).ToString("F3")} μs"; } else if (x < 1) { xString = $"{(x * 1000).ToString("F3")} ms"; } else { xString = $"{x.ToString("F3")} s"; } if (y < 1E-3) { yString = $"{(y * 1E6).ToString("F3")} μV"; } else if (y < 1) { yString = $"{(y * 1000).ToString("F3")} mV"; } else { yString = $"{y.ToString("F3")} V"; } } lblScopeCursor.Text = $"{yString} @ {xString}"; }
/** * Single clicking in the graph will change the summary to be the current frame. */ private void NetworkChart_CursorPositionChanged(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { CurrentFrame = (int)e.NewPosition; if (CurrentNetworkStream != null && CurrentFrame >= 0 && CurrentFrame < CurrentNetworkStream.Frames.Count) { SummaryTextBox.Lines = CurrentNetworkStream.Frames[CurrentFrame].Filter(CurrentActorFilter, CurrentPropertyFilter, CurrentRPCFilter).ToStringArray(); #if true DetailTextBox.Lines = CurrentNetworkStream.Frames[CurrentFrame].Filter(CurrentActorFilter, CurrentPropertyFilter, CurrentRPCFilter).ToDetailedStringArray(CurrentActorFilter, CurrentPropertyFilter, CurrentRPCFilter); #else // Show a performance info DetailTextBox.Lines = CurrentNetworkStream.Frames[CurrentFrame].Filter(CurrentActorFilter, CurrentPropertyFilter, CurrentRPCFilter).ToActorPerformanceString(CurrentNetworkStream, CurrentActorFilter, CurrentPropertyFilter, CurrentRPCFilter); #endif // Populate the new actor performance view CurrentNetworkStream.Frames[CurrentFrame].Filter(CurrentActorFilter, CurrentPropertyFilter, CurrentRPCFilter).ToActorPerformanceView(CurrentNetworkStream, ActorPerformanceView, CurrentActorFilter, CurrentPropertyFilter, CurrentRPCFilter); } }
private void OnPerformanceCursorPositionChanged(object sender, CursorEventArgs e) { if (chPerformance.Series.Count > 0 && _currentRecords.Count > 0) { var index = _currentRecords.FindIndex(p => p.Value16.ToOADate() >= e.NewPosition); if (_lastPointIndex != index && index >= 0) { _lastPointIndex = index; SetPerformanceInfo(); } Debug.WriteLine(e.NewPosition); } }
// Cursor Position Changing Event private void chart1_CursorPositionChanging(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { SetPosition(e.Axis, e.NewPosition); }
private void chart_SelectionRangeChanged(object sender, CursorEventArgs e) { OnZoomChanged(this, EventArgs.Empty); }
private void chart1_SelectionRangeChanged(object sender, CursorEventArgs e) { //chart1.ChartAreas["ChartArea1"].AxisX.ScaleView.Position = e.NewPosition; }
void yChart_CursorPositionChanging(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { SetAllSelectionsFromYChartSelection(); }
private void chartZ_SelectionRangeChanged(object sender, CursorEventArgs e) { double t = 0; double startPoint = this.chartZ.ChartAreas[0].CursorX.SelectionStart; double stopPoint = this.chartZ.ChartAreas[0].CursorX.SelectionEnd; if (startCounter > 0) { if (startPoint != stopPoint) { if (stopPoint < startPoint) { t = startPoint; startPoint = stopPoint; stopPoint = t; } this.chartX.ChartAreas[0].CursorX.SelectionStart = startPoint; this.chartX.ChartAreas[0].CursorX.SelectionEnd = stopPoint; this.chartY.ChartAreas[0].CursorX.SelectionStart = startPoint; this.chartY.ChartAreas[0].CursorX.SelectionEnd = stopPoint; calculateSelection(startPoint, stopPoint, stc); colorsForGrid(); dataGrid.Rows[dataGrid.SelectedRows[0].Index].Cells[24].Value = startPoint; dataGrid.Rows[dataGrid.SelectedRows[0].Index].Cells[25].Value = stopPoint; } } }
private void chartX_CursorPositionChanging(object sender, CursorEventArgs e) { }
private void chart1_CursorPositionChanged_1(object sender, CursorEventArgs e) { if ((e.ChartArea.CursorX.Position - 1) > 0) { try { DataPoint dp = chart1.Series[0].Points[(int)Math.Max(e.ChartArea.CursorX.Position - 1, 0)]; foreach (Title title in chart1.Titles) { if (title.Name == "close") title.Text = "close " + dp.YValues[3]; if (title.Name == "open") title.Text = "open " + dp.YValues[2]; if (title.Name == "high") title.Text = "high " + dp.YValues[0]; if (title.Name == "low") title.Text = "low " + dp.YValues[1]; String dt = DateTime.FromOADate(dp.XValue).ToShortTimeString(); if (title.Name == "time") title.Text = dt; dt = DateTime.FromOADate(dp.XValue).ToShortDateString(); if (title.Name == "date") title.Text = dt; } } catch { }; } }
/** * Selection dragging on the X axis will update the summary to be current selection. */ private void NetworkChart_SelectionRangeChanged(object sender, CursorEventArgs e) { if ( ( CurrentNetworkStream == null ) || ( CurrentNetworkStream.Frames.Count == 0 ) ) { return; } if ( e.NewSelectionEnd - e.NewSelectionStart < 1 ) { return; // Single click, ignore, handled above } if( e.Axis.AxisName == AxisName.X ) { ActorPerfPropsDetailsListView.Items.Clear(); RangeSelectStart = Math.Max( 0, ( int )NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.ViewMinimum ); RangeSelectEnd = Math.Min( CurrentNetworkStream.Frames.Count, ( int )NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.ViewMaximum ); CancelSelectRangeThread(); SelectRangeThread = new Thread( () => SelectRangeWorker( RangeSelectStart, RangeSelectEnd ) ); SelectRangeThread.Start(); } }
private void chart1_SelectionRangeChanging(object sender, CursorEventArgs e) { ////chart1.ChartAreas["ChartArea1"].CursorX.SelectionEnd //chart1.ChartAreas["ChartArea1"].CursorX.SelectionStart = e.NewSelectionStart; //chart4.ChartAreas["ChartArea1"].CursorX.Position = e.NewPosition; }
/** * Selection dragging on the X axis will update the summary to be current selection. */ private void NetworkChart_SelectionRangeChanged(object sender, CursorEventArgs e) { if ((CurrentNetworkStream == null) || (CurrentNetworkStream.Frames.Count == 0)) { return; } if( e.Axis.AxisName == AxisName.X ) { int SelectionStart = Math.Max( 0, (int) NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.ViewMinimum); int SelectionEnd = Math.Min( CurrentNetworkStream.Frames.Count, (int) NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.ViewMaximum); // Create a partial network stream with the new selection to get the summary. PartialNetworkStream Selection = new PartialNetworkStream( CurrentNetworkStream.Frames.GetRange(SelectionStart,SelectionEnd-SelectionStart), CurrentNetworkStream.NameIndexUnreal, 1 / 30.0f ); SummaryTextBox.Lines = Selection.Filter(CurrentActorFilter,CurrentPropertyFilter,CurrentRPCFilter).ToStringArray(); } }
private void chartZ_SelectionRangeChanging(object sender, CursorEventArgs e) { selectionChanging(e); }
private void selectionChanging(CursorEventArgs e) { double startPoint = e.NewSelectionStart; double stopPoint = e.NewSelectionEnd; if(startPoint <= 0) { startPoint = 1; } if (stopPoint <= 0) { stopPoint = 1; } if (startCounter > 0) { int count = chartX.Series[stc].Points.Count(); if (startPoint > count) { startPoint = count; } if(stopPoint > count) { stopPoint = count; } String filter = "SeriesNumber='" + stc + "' and Number =" + startPoint;// + " and number =" + stopPoint; DataView custDV = new DataView(DataSetValues.Tables["AllValues"], filter, "startNumber", DataViewRowState.CurrentRows); String selectionString = ""; selectionString = custDV[0][4].ToString(); filter = "SeriesNumber='" + stc + "' and Number =" + stopPoint; custDV = new DataView(DataSetValues.Tables["AllValues"], filter, "startNumber", DataViewRowState.CurrentRows); selectionString = selectionString + "-" + custDV[0][4].ToString(); // chartX.Titles.Insert(0, new Title(selectionString)); if (chartX.Titles.Count == 0) { chartX.Titles.Add(selectionString); chartY.Titles.Add(selectionString); chartZ.Titles.Add(selectionString); } else { chartX.Titles[0].Text = selectionString; chartY.Titles[0].Text = selectionString; chartZ.Titles[0].Text = selectionString; } } }
private void chart1_CursorPositionChanged(object sender, CursorEventArgs e) { }
private void chartParlin_CursorPositionChanged(object sender, CursorEventArgs e) { try { //DataPoint pt = chartParlin.Series[0].Points[(int)Math.Max(e.ChartArea.CursorX.Position - 1, 0)]; // do what is need with the data point //pt.MarkerStyle = MarkerStyle.Square; // } catch (Exception ex) { //MessageBox.Show(ex.Message); } }
private void chartDataInfo_CursorPositionChanged(object sender, CursorEventArgs e) { this.SetPosition(e.Axis, e.NewPosition); }
/// <summary> /// Cursor changed event of FFT view /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void spectrum_CursorPositionChanged(object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs e) { ushort index = (ushort)((spectrum.ChartAreas["ChartArea1"].CursorX.Position) / //find index of chart data point closest to cursor position (spectrum.ChartAreas["ChartArea1"].CursorX.Interval)); if (spectrum.Series[0].Points.Count >= index) { double x = spectrum.Series[0].Points[index].XValue; spectrum.ChartAreas["ChartArea1"].CursorY.Position = spectrum.Series[0].Points[index].YValues[0]; string rmsString; string xString; if (x > 1E3) { xString = $"{(x/1E3).ToString("F3")} kHz"; } else { xString = $"{x.ToString("F3")} Hz"; } if (rbDbm.Checked) { // y is in dbm. double dBm = spectrum.Series[0].Points[index].YValues[0]; double vrms = Math.Sqrt(Math.Pow(10, (dBm / 10)) * .05); if (vrms < 1E-3) { rmsString = $"{(vrms*1E6).ToString("F3")} μVrms"; } else if (vrms < 1) { rmsString = $"{(vrms*1E3).ToString("F3")} mVrms"; } else { rmsString = $"{vrms.ToString("F3")} Vrms"; } lblFFTCursor.Text = $"{dBm.ToString("F3")} dBm / {rmsString} @ {xString}"; } else { // y is in Vrms double Vrms = spectrum.Series[0].Points[index].YValues[0]; if (Vrms < 1E-3) { rmsString = $"{(Vrms * 1E6).ToString("F3")} μVrms"; } else if (Vrms < 1) { rmsString = $"{(Vrms * 1E3).ToString("F3")} mVrms"; } else { rmsString = $"{Vrms.ToString("F3")} Vrms"; } // Vrms to dBm double dbm = (10 * Math.Log10(Math.Pow(Vrms, 2) / 50.0)) + 30; // 50 Ohm , 1mW = 30dBm lblFFTCursor.Text = $"{dbm.ToString("F3")} dBm / {rmsString} @ {xString}"; } } }
private void chart1_CursorPositionChanging(object sender, CursorEventArgs e) { foreach (Chart chart in charts) { chart.ChartAreas["ChartArea1"].CursorX.Position = e.NewPosition; chart.Update(); } //chart1.ChartAreas["ChartArea1"].CursorX.Position = e.NewPosition; //chart4.ChartAreas["ChartArea1"].CursorX.SelectionStart = e.NewSelectionStart; //chart4.ChartAreas["ChartArea1"].CursorX.SelectionEnd = e.NewSelectionEnd; }