Reputation: 1184
I am look at the System.Windows.Forms.DataVisualization.Charting.Chart class, and I cannot figure out how to enable the selection of points or series (like in Excel charts). Is the functionality there, or do I have to implement it myself?
Thank you.
Upvotes: 0
Views: 4693
Reputation: 1184
For anyone in the future that is faced with the same problem and wants a quick answer/read, the below snippet of code does the trick:
ChartArea _chartarea;
Series _data;
private void Plot_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
HitTestResult result = _plot.HitTest(e.X, e.Y);
if (result.ChartElementType == ChartElementType.DataPoint && result.ChartArea == _chartarea && result.Series == _data)
{
// A point is selected.
}
}
Upvotes: 2