Reputation: 910
I am trying to create bar line graph using Highcharts.Chart()
and I want to add rangeSelector
according to inputDateFormat: '%Y-%m-%d'
format.
I saw there are lot of ways to add rangeSelector
in inputDateFormat: '%Y-%m-%d'
format using Highcharts.stockChart()
but i couldn't able to find a way to do it using Highcharts.Chart(). I used milliseconds and normal date formats as input data set date format. But rangeSelector
didn't work it always goes to 1970-01-01.
Is there any way to take rangeSelector
as '%Y-%m-%d' format using Highcharts.Chart()?
this is millisecond format example - http://jsfiddle.net/0x35kL78/2/
this is month format example - http://jsfiddle.net/zuv1d4st/
Upvotes: 0
Views: 599
Reputation: 5803
There are 2 reasons for why it defaults to 1970-01-01.
You are using strings for the x values. It needs to be numbers. So by changing all values from this:
['1551420000000', 49.9],
To
[1551420000000, 49.9],
That takes care of the first series, the second series ([56.6,46.3,32.8,43.4,40.8,43.0,43.1,44.6,45.7,27.8,39.9,29.3,27.9,27.4,17.6]
) data does not have any timestamp, so it will by default be plotted like this:
[0, 56.6],
[1, 46.3],
[2, 32.8],
...
Which is 0,1,2 milliseconds after 1970-01-01. Your options are to either include the timestamp like for your first series. Or if the values are consistently spaced, you can use pointStart and pointInterval to accomplish this.
I matched the second series values to your first series milliseconds for an example: http://jsfiddle.net/ewolden/vnkxrq80/4/
Upvotes: 1