Removing legend on charts with chart.js v2

前端 未结 3 1822
天命终不由人
天命终不由人 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条回答
  •  -上瘾入骨i
    2021-01-30 10:43

    You can change default options by using Chart.defaults.global in your javascript file. So you want to change legend and tooltip options.

    Remove legend

    Chart.defaults.global.legend.display = false;
    

    Remove Tooltip

    Chart.defaults.global.tooltips.enabled = false;
    

    Here is a working fiddler.

提交回复
热议问题