如何在 Chart.js 中使用百分比刻度刻度、百分比、如何在、js

2023-09-07 12:12:46 作者:新欢与旧爱.

I tried to look it up in the documentation (all examples I found elsewhere did not work anymore, probably due to an outdated syntax for earlier versions) how to use "scaleLabel", but there it references to the scale title configuration with a link which does not exist (anymore): http://www.chartjs.org/docs/#scale-title-configuration

Can someone please provide a working example?

解决方案 chart.js 饼图显示百分比 实战图表 百分比图 下篇 方格百分比...

Scale title configuration is a header if you scroll down in the documentation.

Here is a simple bar chart example, using scaleLabel which is sligtly modified to illustrate a percentage.

https://jsfiddle.net/r71no58a/4/

scales: {
   yAxes: [{
       ticks: {
           min: 0,
           max: 100,
           callback: function(value) {
               return value + "%"
           }
       },
       scaleLabel: {
           display: true,
           labelString: "Percentage"
       }
   }]
}

 
精彩推荐
图片推荐