作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道如何在圆环图和图例上显示标签,我使用 Chart.js 作为插件
我使用了scaleShowLabels: true
但它不起作用
这是我的代码:
var data = [{
value: 30,
color: "#F7464A",
label: "Yasser"
}, {
value: 50,
color: "#E2EAE9",
label: "Zeyd"
}, {
value: 100,
color: "#D4CCC5",
label: "Mouad"
}, {
value: 40,
color: "#949FB1",
label: "Hanine"
}, {
value: 120,
color: "#4D5360",
label: "Kheira"
}
]
var options = {
animation: false,
scaleShowLabels: true
};
//Get the context of the canvas element we want to select
var c = $('#myChart');
var ct = c.get(0).getContext('2d');
var ctx = document.getElementById("myChart").getContext("2d");
/*************************************************************************/
myNewChart = new Chart(ct).Doughnut(data, options);
最佳答案
我找到了Chart js主要问题的所有解决方案,
这是一个编辑过的js文件,其中包含所有代码示例,您可以在这里找到有关它的更多信息:
关于javascript - 如何在 Chart.js 中的圆环图上显示标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29345407/
我是一名优秀的程序员,十分优秀!