Chartjs-Chart JS – Line chart with days in x-axis

1👍

Your variable dataDateTime, for some reason, you are pushing it as an object in the label value, right here:

labels.push({dataDateTime});

That’s why you are getting an X-axis label with [Object object]… You have two possible solutions:

1.Change the push:
labels.push(dataDateTime);

2.Add a callback to the xAxes[0].ticks property:

xAxes: [{
  ticks: {
    callback: function(value, index, values) {
       return value.dataDateTime
    }
  }
}]

Both will work well (I tested), you also can check this fiddle that I made, to check it working (using the first solution)

Leave a comment