小编Har*_*hit的帖子

如何在 Chart.js 上显示半甜甜圈中的数据值

我想问一下是否可以在半圆环图上显示数据值?想要通过从这里的数组中获取其值来将数据值显示为图表底部的文本是链接:https : //jsfiddle.net/z638ttv0/16/

我在这里先向您的帮助表示感谢

var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
    type: 'doughnut',
    data: {
        labels: ["Red"],
        datasets: [{
            label: '# of Votes',
            data: [50,100-50],
            backgroundColor: [

                'rgba(255, 159, 64, 0.2)'
            ],
            borderColor: [

                'rgba(255, 159, 64, 1)'
            ],
            borderWidth: 1
        }]
    },
    options: {
        rotation: 1 * Math.PI,
        circumference: 1 * Math.PI
    }
});
Run Code Online (Sandbox Code Playgroud)

charts

1
推荐指数
1
解决办法
9742
查看次数

标签 统计

charts ×1