Chart.js,设置最大值 [英] Chart.js, set a max value

查看:1985
本文介绍了Chart.js,设置最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 Chart.js 制作一张雷达图,但它只有最大的值。我想将它设置为标准的最大值,所以范围是0到100,你可以看到你的进度是如何在不同的主题。有没有人知道如何使用 Chart.js 来设置雷达图的最大值范围?

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?

(我试图添加一个额外的数据集,设置为100,使它不可见,但是你看到的数据,如果你悬停在雷达的点,

(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)

推荐答案

您可以使用scaleOverride来执行此操作,例如

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/

这篇关于Chart.js,设置最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆