Highcharts x-axis datetime issue

2019-07-23 15:43发布

问题:

in my javascript I defined how to populate a LineChart of Highcharts. This is populated with the data given by a database. The x-axis of the chart is of datetime type and the x-value is DateTime type.

xAxis: {
     type: 'datetime',
     labels: {
            formatter: function () {
               return Highcharts.dateFormat('%d %b - %H:%M:%S', this.value);
            }
     }
},


lineCharts[index].series[roiIndex].addPoint([point.creationDateTime, point.result]);

but what I see is the following:

I can't find the solution..does anyone have an idea? Thanks!

EDIT

Now creationDateTime is the epoch time expressed in milliseconds:

DateTime date = roi.created_at;
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var creationDateTimeEpoch = Convert.ToInt64((date - epoch).TotalMilliseconds);

infact, the value is that converted with https://www.epochconverter.com/ corresponds to the correct value. But now I see the series .

回答1:

As suggested, x value must be epoch time, in milliseconds. My final error was that they were all the same, so I saw the vertical lines.