Show values on top of bars in chart.js

后端 未结 7 1130
自闭症患者
自闭症患者 2020-12-04 13:34

Please refer this Fiddle : https://jsfiddle.net/4mxhogmd/1/

I am working on chart.js If you see in fiddle, you will notice that value which is top on bar is not pro

7条回答
  •  日久生厌
    2020-12-04 14:03

    This worked in my case.(plugins section below)

    options: {
        responsive: true,
        scales: {
          yAxes: [{
            ticks: {
              beginAtZero: true,
            }
          }]
        },
        plugins: {
          datalabels: {
            anchor: 'end',
            align: 'top',
            formatter: Math.round,
            font: {
              weight: 'bold'
            }
          }
        }
      }
    

    Happy Coding.

提交回复
热议问题