我正在使用 Chart.js v2.6 输出饼图。数据是从MySQL数据库中获取的。图表渲染正确,但我需要向数据值添加箭头,如下面的屏幕截图所示。
带箭头的饼图示例:
下面是我使用 Chart.js 输出饼图的代码:
var chartdata_order_status = {
labels: status,
datasets: [{
label: 'Order status',
backgroundColor: ["#00b0f0","#92d050","#ffc000","#ff6dd9"],
data: count_status
}]
};
var pieGraph = new Chart(ctx3, {
type: 'pie',
data: chartdata_country_orders,
options: {
pieceLabel: {
mode: 'value',
position: 'outside',
fontColor: '#000',
format: function (value) {
return '$' + value;
}
},
title: {
display: true,
text: 'Total Sales by Country - Top 5',
fontSize: 15,
fontStyle: 'bold'
},
legend: {
display: true,
position: 'bottom',
},
}
});
我没有包含从 MySQLtable 获取数据的 PHP 代码。