Accepted answer

the idea behind using highchart stockchart is it uses x-axis label as timestamp.

solution to "how can i make my x-axes to use my own timestamp api data? " should be converting data[i].timestamp by parsing to real timestamp and create nested array of 'accelero_x' and pass that array to series data.

highcharts.getjson('', function (data) {
var accelero_x = [], timestamp = [];
      for (var i=0; i<data.length; i++){
      //modification start -----
      let inarr = [];
      let trimdate = data[i].timestamp.split('t')[0]; // here we have many ways to extract only the date correctly
      //modification end -----
// create the chart
highcharts.stockchart('container', {

    rangeselector: {
        selected: 1

    title: {
        text: 'accelero x'

    series: [{
        name: 'accelero x',
        data: accelero_x,
        type: 'spline',
        tooltip: {
            valuedecimals: 2



  • here is an api options how to set the range selections options:

  • your second part of the question - highcharts requires data in the following formats:

    • array of values - like: [10,20,30,40] - highcharts reads it as an array of y values and set default x values - 1, 2, 3, 4

    • array of arrays - like: [[3, 24], [5, 42], [8,33]] - where first value in the array is an x and the second one is the y - [x, y]

    • array of objects - like: [{x: 3, y: 24}, {x: 5, y: 42}] - here is quite obvious

the xaxis could be a datatime type, where x value is a value in milliseconds format, that's mean you will need to convert your data into the milisecond value to set it, like here:

Related Query

More Query from same tag