[Chartjs]-How can I load multiple Chartjs charts with different data on the same page?

1👍

well, then you can use different ids for different charts.not even this every jquery or js plugin can be used like this.

  <canvas id="yourid1" width="400" height="400"></canvas><canvas id="yourid2" width="400" height="400"></canvas>
var ctx = document.getElementById("yourid2");
var myChart = new Chart(ctx, {
    type: 'bar',
    data: {
        labels:......///and so on for your another charts
    var ctx = document.getElementById("yourid1");
    var myChart = new Chart(ctx, {
        type: 'bar',
        data: {
            labels:.......///not the complete code. just reference

same again with another id for different charts

<canvas id="yourid2" width="400" height="400"></canvas>
var ctx = document.getElementById("yourid2");
var myChart = new Chart(ctx, {
    type: 'bar',
    data: {
        labels:......///and so on for your another charts

Leave a comment