ambaetzgi
Posts: 19
Joined: Tue Feb 22, 2022 7:52 am

line across the graphic

i have created a graph. unfortunately, a line is always drawn from the last value to the first. what am i doing wrong?
example: https://jsfiddle.net/t6qbwdyL/
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: line across the graphic

Hello ambaetzgi,
We appreciate you reaching out to us with your inquiry.

You can see that there is an error 15 in the console, which is:
Highcharts expects data to be sorted
This happens when creating a line series or a stock chart where the data is not sorted in ascending X order.

For performance reasons, Highcharts does not sort the data, instead it requires that the implementer pre-sorts the data.
Highcharts expect data as sorted, so to fix your chart you have to sort your data, e.g. like in the demo below.

Demo: https://jsfiddle.net/BlackLabel/bytha82s/

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

Return to “Highcharts Usage”