Chart.js 如何在圆环图中生成最大值
我正在使用reactJs和chartjs 我想制作以下图表: 我有以下代码Chart.js 如何在圆环图中生成最大值,chart.js,Chart.js,我正在使用reactJs和chartjs 我想制作以下图表: 我有以下代码 var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'pie', data: { labels: ['OK'], datasets: [{ label: '# of Tomatoes', data: [12], backgroundColor: [
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'pie',
data: {
labels: ['OK'],
datasets: [{
label: '# of Tomatoes',
data: [12],
backgroundColor: [
'#0EA4EA',
],
borderWidth: 1
}]
},
options: {
legend: {
display: false
},
cutoutPercentage: 80,
rotation: 0.75 * Math.PI,
circumference: 1.5 * Math.PI,
title: {
display: true,
position: 'bottom',
},
scale: {
ticks: {
min: 0,
max: 150
}
}
}
});
但是我找不到一种方法将弧的最大值设置为150
我认为您需要指定非蓝色的区域:
labels: ['Ok', 'Not Ok'],
datasets: [{
label: '# of Tomatoes',
data: [12, 138],
backgroundColor: [
'#0EA4EA',
],
borderWidth: 1
}]