I'm using a basic chart in Chart.js - I'd like to know if it would be possible to use a custom scale on my axis, so for example I want my data points to be plotted on a 0-10 data scale. Is this possible?
我正在使用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>
1 个解决方案
#1
2
Check out my question and answer HERE
看看我的问题,然后在这里回答
You need to set the scaleSteps
,scaleStepWidth
and scaleStartValue
. In the above example it is:
您需要设置scaleSteps,scaleStepWidth和scaleStartValue。在上面的例子中它是:
scaleSteps: 4,
scaleStepWidth: 5,
scaleStartValue: 0
Which added to a total of 20 with 4 lines through. You can play about with these values to get your desired effect.
其*增加了20行,共4行。您可以使用这些值来获得所需的效果。
#1
2
Check out my question and answer HERE
看看我的问题,然后在这里回答
You need to set the scaleSteps
,scaleStepWidth
and scaleStartValue
. In the above example it is:
您需要设置scaleSteps,scaleStepWidth和scaleStartValue。在上面的例子中它是:
scaleSteps: 4,
scaleStepWidth: 5,
scaleStartValue: 0
Which added to a total of 20 with 4 lines through. You can play about with these values to get your desired effect.
其*增加了20行,共4行。您可以使用这些值来获得所需的效果。