Nevron Forum

Data value of infinity causes Chart to hang indefinitely

https://www.nevron.com/Forum/Topic3681.aspx

By Kevin Harrison - Tuesday, June 15, 2010

I am creating a simple 3-point line chart in C#, which displays perfectly, unless I set one of the data values to double.PositiveInfinity.  Then the chart hangs indefinitely trying to plot, using maximum CPU.  Is this a known issue?  Yes, it is stupid to deliberatly pass infinity to the chart, but it could happen in real life.

Thanks, Kevin

By Milen - Wednesday, June 30, 2010

Hi Kevin,

The issues with Double.NaN and Double.Infinity are fixed in our latest service pack. Please download the updated product from our website.

Best Regards,
Milen

By Kevin Harrison - Thursday, July 1, 2010

Thanks.  The service pack has fixed the hanging issue with infinities and oddly drawn charts with double.NaN.

Double.NaN values are treated as missing points.

When there is an infinity in any data series plotted on one of the y-axes, then nothing whatsoever is plotted on the axis. So you could have one series with a single infinity data point, and ten others which are OK, but none are plotted.  I think it would be useful to have an option of "Treat infinities as missing points" so the rest of the data could be plotted.

By Kevin Harrison - Tuesday, August 24, 2010

Are there any plans to treat infinities the same as NaN?  It is rather disappointing that a single infinity in one series, prevents all series of the same type being plotted.

By Blagovest Milanov 1 - Tuesday, October 5, 2010

Hi Kevin,

Yes we're going to add an option to treat infinity as missing values. Should be ready in the next SP of the component.

Best regards,
Bob

By Kevin Harrison - Tuesday, October 5, 2010

Great news Bob.  Any idea when it will appear?
By Kevin Harrison - Wednesday, November 17, 2010

I believe this has now been implemented but I cannot find it, please can you tell me how to treat infinties as missing points?
By Nevron Support - Wednesday, November 17, 2010

Hi Kevin,

Yes it present in the current download – you just have to set the TreatInfinityAsEmpty to the respective value series – for example:

NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(Double.PositiveInfinity);
bar.Values.Add(Double.NegativeInfinity);
bar.Values.Add(40);

bar.Values.TreatInfinityAsEmpty = true;

chart.Series.Add(bar);