NaN point value makes series disappear #3571
Comments
Not sure how to handle this... Our docs do say that values should be either numbers or null. Checking for isNaN would add another case to check for and decrease performance. |
I understand. Just thought it was worth mentioning, since it took me a while to find the reason why the series weren't being drawn without error. |
It makes a lot of sense to add this check. We are using highcharts with typed arrays which can contain NaNs. The current buggy handling of NaN values leads to an additional conversion into a js array which costs us far more performance than this simple check would. Maybe you could make it configurable? |
Could I add a 'me too' to this. The bug is that if NaN appears in the data then the series is drawn in invisible ink. You can still hover over it with the mouse but the line isn't shown. This really doesn't make any sense; by all means fail if NaNs are given but not in this weird way which isn't immediately visible. (If there are ten series on the chart and one of them becomes invisible without warning...) |
Thanks! |
1 similar comment
Thanks! |
You're welcome! |
Thanks for fixing. I've tested the fix. There is one edge case that does not appear to be fixed: a NaN at the very first point of a timeseries will still cause the whole timeseries to disappear. Not a big deal for us, but it seems like it might be worth mentioning. |
Thank you for pointing this out! Live demo: http://jsfiddle.net/993ee7cx/2/ Internal note: |
@TorsteinHonsi Similarly to |
Interesting question... H.isNumber = function (n) {
return typeof n === 'number' && !isNaN(n) && n !== Infinity && n !== -Infinity;
}; On the other hand, |
Yeah, I'm not sure what users would expect to happen in these cases either. I guess treating them as invalid and filtering out the points is the most straightforward solution (there is also |
@TorsteinHonsi maybe we should also add the support for NaN as string? |
Didn't find any report on this issue so here it goes.
http://jsfiddle.net/993ee7cx/
If an area or line series has a point with 'NaN' value, the whole line disappears. In the previous example you can see the points, but for series with hundreds of points you can only see the tooltip.
http://jsfiddle.net/993ee7cx/1/
Null values seem to be controlled, but since Error #14 recommends the use of 'parseFloat()' and it returns NaN for null values it can be a problem for DB retrieved data.
For the time being I went around it with a simple check
The text was updated successfully, but these errors were encountered: