[Chartjs]-How to use Real time chart in react?

2👍

This is because your scale config is wrong, you are using V2 syntax while using V3, changing it to this should resolve the issue:

scales: {
  x: {
    type: "realtime",
    realtime: {
      onRefresh: function() {
        data.datasets[0].data.push({
          x: Date.now(),
          y: Math.random() * 100
        });
      },
      delay: 300,
      refresh: 300
    }
  },
  y: {
    max: 100,
    min: 0
  }
}

For all changes please read the migration guide

Leave a comment