我正在显示饼图.但是如何在饼图中显示标签.
下面是饼图的chart.js代码.
this.Pie = function(data, options) {
chart.Pie.defaults = {
segmentShowStroke: true,
segmentStrokeColor: "#fff",
segmentStrokeWidth: 2,
animation: true,
animationSteps: 100,
animationEasing: "easeOutBounce",
animateRotate: true,
animateScale: false,
onAnimationComplete: null
};
var config = (options) ? mergeChartConfig(chart.Pie.defaults, options) : chart.Pie.defaults;
return new Pie(data, config, context);
};
Run Code Online (Sandbox Code Playgroud)
以下是用于显示饼图的html文件的代码
码:
var data = [{
value: 20,
color: "#637b85"
}, {
value: 30,
color: "#2c9c69"
}, {
value: 40,
color: "#dbba34"
}, {
value: 10,
color: "#c62f29"
}];
var canvas = document.getElementById("hours");
var ctx = …Run Code Online (Sandbox Code Playgroud)