Search code examples
chartshighchartsangular2-highcharts

Highcharts - Adding a point with addPoint stretches time


When you spam click Add Point on the JSFiddle below, you will see that it does not respect the time interval, and instead it stretches the time.

https://jsfiddle.net/ouc2x3ng/1/

I have read this: https://www.highcharts.com/demo/spline-irregular-time, and I can't see what is so special that makes it work.

enter image description here


Solution

  • You need to disable the ordinal property for xAxis, which is enabled in Highstock by default:

    xAxis: {
        ordinal: false
    },
    

    Live demo: https://jsfiddle.net/BlackLabel/apscbLjn/

    API Reference: https://api.highcharts.com/highstock/xAxis.ordinal