hansbauer
Posts: 3
Joined: Wed Jan 26, 2022 12:01 am

Timestamp interpreted as Value

Hi

As you can see in the chart my timestamp get's interpreted as Value:

E.g von the server I get the following data point:

'2020-05-01T01:14:59.595+00:00', 201

To get this JSON-Date into the Highcharts format I do:

new Date('2020-05-01T01:14:59.595+00:00').getTime()

What gives me: 1588295699595

But that seems to be wrong:

Bildschirmfoto 2022-01-26 um 01.03.49.png
Bildschirmfoto 2022-01-26 um 01.03.49.png (201.01 KiB) Viewed 220 times
Bildschirmfoto 2022-01-26 um 00.58.05.png
Bildschirmfoto 2022-01-26 um 00.58.05.png (95.98 KiB) Viewed 220 times
My chart settings: /THANK YOU

Code: Select all

  const options = {
            chart: {
                type: 'line',
                zoomType: 'x',
                height: 600
            },

            boost: {
             useGPUTranslations: true
           },

            navigator: {
                adaptToUpdatedData: false,
                series: Object.values(series)
            },

            scrollbar: {
                liveRedraw: false
            },



            rangeSelector: {
                buttons: [
                  {
      type: 'millisecond',
      count: 10000,
      text: '10s'
    }, {
                    type: 'm',
                    count: 1,
                    text: 'n'
                }, {
                    type: 'hour',
                    count: 1,
                    text: 's'
                }, {
                    type: 'day',
                    count: 1,
                    text: 'd'
                },
                {
                    type: 'week',
                    count: 1,
                    text: 's'
                },
                {
                    type: 'month',
                    count: 1,
                    text: 'd'
                }],
                buttonSpacing : 5,
                buttonTheme : {
                  width: 55,
                  height : 12,
                },
                inputEnabled: false, // it supports only days
                //selected: 4, // all
                allButtonsEnabled: true
            },

            xAxis: {

              events: {
                afterSetExtremes: afterSetExtremes
              }
            },

            yAxis: {
                floor: 0
            },

            //yAxis: Object.keys(traces).map(function(x) {  return { title: { text:  x }, visible: false } }),

            series: Object.values(series)
        };
Attachments
Bildschirmfoto 2022-01-26 um 00.59.31.png
Bildschirmfoto 2022-01-26 um 00.59.31.png (22.9 KiB) Viewed 220 times
hansbauer
Posts: 3
Joined: Wed Jan 26, 2022 12:01 am

Re: Timestamp interpreted as Value

My issue was that I didn't use a two-dimensional array
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Timestamp interpreted as Value

Hi hansbauer,

Welcome to our forum and thanks for contacting us with your question!

It seems that you want to use line series. You need to make sure that you data first any of the formats specified here:
https://api.highcharts.com/highcharts/series.line.data

Data from your second screen looks fine, it should be passed directly to series.data property, but is seems that you have solved it already.

If there is anything else that I can help you feel free to contact me anytime.
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”