Chart.js, set a max value

你。 提交于 2020-01-11 14:13:10

问题


I am making a radar chart with Chart.js, but it only gets as big as the biggest value that's in it. I want it to be set to a standard max value, so the range is 0 to 100, and you can see how your progress is on different topics. Does anyone know how to set a max range of value to the radar chart with Chart.js?

(I tried just adding an extra dataset that's set to 100 and making it invisible, but than you see that data if you hover over the points in the radar, so that doesn't really look right)


回答1:


You can use the scaleOverride to do this, like so

...
var myChart = new Chart(ctx).Radar(data, {
    scaleOverride: true,
    scaleSteps: 5,
    scaleStepWidth: 20,
    scaleStartValue: 0,
});

Fiddle - http://jsfiddle.net/bkm60q5y/



来源:https://stackoverflow.com/questions/33011814/chart-js-set-a-max-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!