[Chartjs]-How to show REALTIME chartjs of specific ID in mysql when click on corresponding marker on googlemap javascript

1👍

I assume you using latest ChartJS version. You need to a function to update data in Chartjs instance. Then pass it to setInterval for realtime update.

const updateChartData = (chart, ajaxData) => {
  const data = chart.data;
  if (data.datasets.length > 0) {
    //data.labels.push(<<LABEL YOUR WANT TO DISPLAY>>)

    for (var index = 0; index < data.datasets.length; ++index) {
      // data.datasets[index].data.push(<<PUSH DATA YOU WANT TO DISPLAY FROM ajaxData>>);
    }
    chart.update();
  }
}

setInterval(() => {
  const ajaxData = $.ajax(dataUrl).then(res => {
    ... // handle response
  })
  updateRealTime(myChart, ajaxData);
}, 1000);

Demo

Leave a comment