score:1

Accepted answer

Your array should show up as [12283, 12281, 12280, etc.] in console as well, instead it shows up as [Number, Number, ...]. Try changing this line:

averageVoltage.push(res[i].average_volatage)

to:

averageVoltage.push(parseInt(res[i].average_volatage))

Additionally, instead of using dates as categories, it could be easier to use the highchart datetime axis. This would let you manipulate how you want the date displayed, have several series with different timestamps in one graph, and many other things. To get this to work, you could do this:

.then(function(res) {
  var averageVoltage = []
  var inputVoltage = []
  for (var i = 0; i < 10; i++) {
    if (res[i].average_volatage !== undefined) {
      averageVoltage.push({x: new Date(res[i].timestamp).getTime(), y: parseInt(res[i].average_volatage)})
    }
  }
  console.log(averageVoltage)

  Highcharts.chart('battery_chart', {
    chart: {
      type: 'line'
    },
    title: {
      text: id
    },
    yAxis: {
      title: {
        text: 'Measurement'
      },
    },
    xAxis: {
      type: 'datetime'
    },
    series: [{
      name: 'Average Voltage',
      data: averageVoltage
    }, 
    ]
});

Related Query

More Query from same tag