gpt4 book ai didi

javascript - ChartJS - 多环圆环图

转载 作者:数据小太阳 更新时间:2023-10-29 05:00:05 25 4
gpt4 key购买 nike

是否可以使用 ChartJS 创建具有多个环的圆环图,如下所示?

multi series donut chart

最佳答案

您可以在 fiddle link 找到解决方案

var ctx = document.getElementById("chart-area").getContext("2d");
var myDoughnut = new Chart(ctx, config);
var config = {
type: 'doughnut',
data: {
datasets: [{
data: [
10,20,30
],
backgroundColor: [
"#F7464A",
"#46BFBD",
"#FDB45C"
],
}, {
data: [
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor()

],
backgroundColor: [
"#F7464A",
"#46BFBD",
"#FDB45C"
],
}],
labels: [
"Red",
"Green",
"Yellow"
]
},
options: {
responsive: true
}
};

关于javascript - ChartJS - 多环圆环图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29254121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com