How to use percentage scale with Chart.js

前端 未结 1 798
星月不相逢
星月不相逢 2021-02-19 08:51

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

相关标签:
1条回答
  • 2021-02-19 09:28

    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"
           }
       }]
    }
    
    0 讨论(0)
提交回复
热议问题