Removing legend on charts with chart.js v2

前端 未结 3 1812
天命终不由人
天命终不由人 2021-01-30 10:10

I\'m making a homepage using, Bootstrap, JQuery and Chart.js (v2). I had my implementation working using v1, but recently just got into Bower and downloaded v2 using that.

3条回答
  •  囚心锁ツ
    2021-01-30 10:33

    The options object can be added to the chart when the new Chart object is created.

    var chart1 = new Chart(canvas, {
        type: "pie",
        data: data,
        options: {
             legend: {
                display: false
             },
             tooltips: {
                enabled: false
             }
        }
    });
    

提交回复
热议问题