multiple chartjs in the same page

后端 未结 6 536
隐瞒了意图╮
隐瞒了意图╮ 2021-01-01 11:04

hi i was trying to use chartjs can be found in this link www.chartjs.org

i tried to draw two chart in the same page using the samples code

i created two dif

6条回答
  •  误落风尘
    2021-01-01 12:09

    Use only one window.onload

    window.onload = function () {
            window.myRadar = new Chart(document.getElementById("canvas1").getContext("2d")).Radar(radarChartData, {
                responsive: true
            });
            var G2 = document.getElementById("canvas2").getContext("2d");
            window.myBar = new Chart(G2).Bar(barChartData, {
                responsive: true
            });
        }
    

提交回复
热议问题