zhy0319
Posts: 8
Joined: Wed Apr 13, 2022 7:31 am

highchart unable to understand number with format in series

I am passing csv data into highchart but it failed to render the chart. The csv file contains formatted number such as "100,000" .
See link to the sample code
http://jsfiddle.net/zhy0319/ahqswd23/10/
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: highchart unable to understand number with format in series

Hello zhy0319,
Thanks for contacting us!

You can see that there is an Highcharts error #14 in the console:
String value sent to series.data, expected Number
This happens if using a string as a data point, for example in a setup like this:

series: [{
data: ["3", "5", "1", "6"]
}]
Highcharts expects numerical data values.

The most common reason for this error this is that data is parsed from CSV or from a XML source, and the implementer forgot to run parseFloat on the parsed value.

Note: For performance reasons internal type casting is not performed, and only the first value is checked (since 2.3).
To avoid this error you can comment a itemDelimiter property like in the first demo. If you want to keep this property you can modify your data and parse proper elements in complete property - see the second demo.

Demo: http://jsfiddle.net/BlackLabel/7amLjwkg/
http://jsfiddle.net/BlackLabel/gL4bt91s/
API Reference: https://api.highcharts.com/highcharts/data.complete

Let me know if you have any further questions!
Regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Usage”