Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set x-axis range in highcharts

Tags:

highcharts

I have multiple time series that do not have the same starting/ending points. I want to fix a starting point and a ending point in x-axis, I tried something like:

    xAxis: {
        min: new Date('2000/10/22'),
        max: new Date('2010/10/22'),
    },

jsfiddle link

But it does not work. Btw, the document on highcharts website has a wrong link for min in xAis.

like image 681
John Sket Avatar asked Jul 25 '13 14:07

John Sket


1 Answers

Min and max should be timestamps, not date objects.

Proper code:

    xAxis: {
        min: new Date('2000/10/22').getTime(),
        max: new Date('2010/10/22').getTime(),
    },

http://jsfiddle.net/34CZK/3/

like image 171
Paweł Fus Avatar answered Nov 10 '22 08:11

Paweł Fus