【发布时间】:2017-06-29 02:56:20
【问题描述】:
我最近将我的 charts.js 库更新为最新版本 (2.5.0)。 此版本不显示图表上的标签。
我有一个在提琴手上工作的例子:http://jsfiddle.net/g6fajwg8。
但是,我完全按照示例定义了我的图表,但仍然看不到图表上的标签。
注意:在 Google 和 Stackoverflow 上有很多这样的问题,但其中大部分是关于在它们上运行良好的旧版本。
var config = {
type: 'pie',
data: {
datasets: [{
data: [
1200,
1112,
533,
202,
105,
],
backgroundColor: [
"#F7464A",
"#46BFBD",
"#FDB45C",
"#949FB1",
"#4D5360",
],
label: 'Dataset 1'
}],
labels: [
"Red",
"Green",
"Yellow",
"Grey",
"Dark Grey"
]
},
options: {
responsive: true,
legend: {
position: 'top',
},
title: {
display: true,
text: 'Chart.js Doughnut Chart'
},
animation: {
animateScale: true,
animateRotate: true
}
}
};
window.pPercentage = new Chart(ChartContext, config);
【问题讨论】:
标签: javascript jquery charts chart.js