Highstock: specify x-axis datetime period

How to specify Highstock xAxis datetime period as it is shown on the picture below (made in a image editor)?

enter image description here

I need to show different line series for specified time period (for example, one week). And there may be cases when size of data period is less than size of the chart period (there are series that starts with a data loss). But Highstock chart is scaled so series starts from chart beginning and the chart has the size of, for example, half of a week, but I need to keep the period the same.

Thank you in advance!

Answer

It is caused by ordinal option, see docs. Disable this and set xAxis.min and xAxis.max. Demo for you: http://jsfiddle.net/L3jqL0hw/

Code sample:

        xAxis: {
            ordinal: false,
            min: Date.UTC(2007, 0, 1),
            max: Date.UTC(2019, 0, 1)
        },

Leave a Reply

Your email address will not be published. Required fields are marked *