Highstock: specify x-axis datetime period Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Highstock: specify x-axis datetime period without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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)
        },
We are here to answer your question about Highstock: specify x-axis datetime period - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji