Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show data values in top of bar chart and line chart in chart.js 3

I would like to know if it's possible to show the chart data in chartjs3. I know there is such a thing for Chartjs2 but i dont know if its possible in 3

like image 439
calvs Avatar asked Oct 23 '25 09:10

calvs


1 Answers

data values on chart

If that's your requirement.

You might want to use chartjs-plugin-datalabels plugin. It works with vue-chartjs.

import Chart from 'chart.js'
import { Line } from 'vue-chartjs'
import ChartJsPluginDataLabels from 'chartjs-plugin-datalabels'

Incase you don't want the plugin globally.

Chart.defaults.global.plugins.datalabels.display = false;

You can find the documentation for adding a plugin https://vue-chartjs.org/api/#addplugin.

like image 92
ejaz Avatar answered Oct 26 '25 12:10

ejaz