tags:

views:

139

answers:

1
+1  Q: 

MS Chart and NaN

I'm using MS Chart with C# and I'm having issues when I try to retrieve almost any meta values from the chart, all I am getting is NaN. 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

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

A: 

It sounds like you might not be properly initializing chart.ChartAreas[0]: Have you set Cursor.IsUserSelectionEnabled to true?

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

If you haven't enabled user selecting then the event will still fire when a user clicks and moves the mouse, but a selection won't take place.

As for

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

This means that the chart will manage the margin itself.

Guildencrantz