Method One: mouse click waveform
Waveform mouse click, click the display position x, y values
private void chart1_MouseClick (object sender, MouseEventArgs e) // chart1 is you build the chart controls, real name according to your own code named
{
HitTestResult HIT = chart1.HitTest (eX, eY);
IF (hit.Series = null! )
{
var = hit.Series.Points the xValue [hit.PointIndex] .XValue;
var = yValue hit.Series.Points [hit.PointIndex] .YValues.First ();
textBox1.Text = string.Format ( "{0: F0}, {1: F0} "," x: "+ xValue," y: "+ yValue); // textbox1 is one designed to build their own content display frame, pop-up may be directly used content messagebox
}
the else
{
textBox1.Text = "not click the waveform curve";
}
}
Call the method:
chart1.MouseClick += new MouseEventHandler(chart1_MouseClick);
Method two: the mouse to move to the corresponding point correlation value is automatically displayed
private void chart1_MouseMove(object sender, MouseEventArgs e)
{
var area = chart1.ChartAreas[0];
double xValue = area.AxisX.PixelPositionToValue(e.X);
double yValue = area.AxisY.PixelPositionToValue(e.Y);
textBox1.Text = string.Format("{0:F0},{1:F0}", xValue, yValue);
}
Call the method:
chart1.MouseMove += new MouseEventHandler(chart1_MouseMove);