This method is used to get the YValue for a given XValue in the series. It is applicable for Line, StepLine, Spline and QuickLine charts only.
Syntax:
Numeric Axis
chart.Series[0].GetYValue(2);
DateTime Axis
chart.Series[0].GetYValue(date);
In the following example, once you click over the chart, a messagebox will be displayed with a YValue for the given XValue.
|
void chart_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { DateTime xValue = new DateTime(2001, 1, 8); Double yValue = chart.Series[0].GetYValue(xValue); MessageBox.Show(yValue.ToString()); } |
If the given XValue is not under the Axis range, the method will return NaN.