MS Chart and NaN

I use MS Chart with C # and I have problems when I try to get almost all meta-values ​​from the chart, all I get is NaN. A couple of examples ...

void chart_CursorPositionChanged(object sender, CursorEventArgs e)
{
            double selectStart = e.NewSelectionStart;
            double selectEnd = e.NewSelectionEnd;
}

e.NewSelectionStart and e.NewSelectionEnd both show NaN for their values.

Another example...

chart.ChartAreas[0].AxisX.Maximum

also NaN. However, if I set it to a value, it correctly reflects it. Any ideas what I'm doing wrong?

+3
source share
2 answers

It looks like you cannot initialize correctly chart.ChartAreas[0]: have you set Cursor.IsUserSelectionEnabledto true?

chart.ChartAreas[0].CursorX.IsSelectionEnabled = true;

If you did not allow the user to select, the event will still fire when the user clicks and moves the mouse, but there will be no choice.

Concerning

chart.ChartAreas[0].AxisX.Maximum == Double.NaN

This means that the chart will control the brand itself.

+1

, CursorEventArgs, , :

void chart_CursorPositionChanged(object sender, CursorEventArgs e)
{
            double selectStart = chart.ChartAreas["ChartArea1"].CursorX.SelectionStart;
            double selectEnd = chart.ChartAreas["ChartArea1"].CursorX.SelectionEnd;

}

, , . , CursorEventArg NaN,

0

Source: https://habr.com/ru/post/1733247/


All Articles