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.
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.
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.