I have an mschart with values and a cursor line moving based on a timer. Is it possible to get the value of a specific series at the cursor position?
Thanks.
You can get current DataPoint value with MouseMove event handler.
private void chart1_MouseMove(object sender, MouseEventArgs e)
{
var source = sender as Chart;
HitTestResult result = source.HitTest(e.X, e.Y);
if (result.ChartElementType == ChartElementType.DataPoint && result.PointIndex != -1)
{
var xValaue = source.Series[0].Points[result.PointIndex].XValue;
var yValaue = source.Series[0].Points[result.PointIndex].YValues[0];
}
}
string ceva = detailChart.Series[1].Points[detailChart.ChartAreas[0].CursorX.Position].GetValueByName("Y").ToString(
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.