Take the 2-minute tour ×  I am using
DataVisualization.Charting.Chart (winform), I need to get the
data point index when user clicks on a line graph in MouseDown
event.  I know there is a HitTest function accepting x & y, but
for a line graph, we only need to verify x, if we scan the y (0
to height of graph), it will work, but the performance is too
bad.  share|improve this question add comment  2 Answers  up
vote 0 down vote accepted  One way to do this is to enable the
cursor  chartArea1.CursorX.IsUserEnabled = true;
chartArea1.CursorX.IsUserSelectionEnabled = true; // set
selection color to transparent so that range selection is not
drawn chartArea1.CursorX.SelectionColor =
System.Drawing.Color.Transparent;  and handle the
CursorPositionChanged event.  private void
chart1_CursorPositionChanged(object sender, CursorEventArgs e)
// find a point (this series only has Y values, so using
position as index works    // for a series with actual X values,
you'd need to Find the closest point    DataPoint pt = ch