我在Chart.js中使用基本图表-我想知道是否可以在轴上使用自定义比例,因此例如,我希望将数据点绘制在0-10数据比例上。这可能吗?
<canvas id="myChart" width="150" height="150"></canvas>
<script>
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'radar',
data: {
labels: ["Staying well", "Looking after yourself", "Where you live", "Feeling safe and being listened to", "Making decisions and managing money", "How you feel"],
datasets: [{
label: "Careplan",
backgroundColor: "rgba(179,181,198,0.2)",
borderColor: "rgba(179,181,198,1)",
pointBackgroundColor: "rgba(179,181,198,1)",
pointBorderColor: "#fff",
pointHoverBackgroundColor: "#fff",
pointHoverBorderColor: "rgba(179,181,198,1)",
data: [5, 8, 9, 4, 6, 6, 5]
}]
},
});
</script>
在这里查看我的问题并回答
您需要设置的scaleSteps
,scaleStepWidth
和scaleStartValue
。在上面的示例中是:
scaleSteps: 4,
scaleStepWidth: 5,
scaleStartValue: 0
其中通过4行添加到总共20条。您可以使用这些值来获得所需的效果。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句