[Chartjs]-Multiple charts not working chart.js

2👍

Your chart definitions are incorrect, try this:

function start(){
    var ctx = document.getElementById("graficoBarra").getContext("2d");
    var BarChart = new Chart(ctx, {
          type: 'bar',
          data: dataBar,
          options: optionsBar          
    });

    var ctx2 = document.getElementById("graficoLinha").getContext("2d");
    var LineChart = new Chart(ctx2, {
          type: 'line',
          data: dataLine,
          options: optionsLine          
    });
}

Full Code in Codepen: 2 Chart.js Charts
Result:

enter image description here

Leave a comment