[Chartjs]-Add Labels to Chart.js Bar Chart

2๐Ÿ‘

โœ…

I noticed your jsfiddle is using chart.js version 1. My answer uses version 2, as that is all I could find documentation for.

Looks like all you need to do is put labels in the data object:

var data = {
  labels: [
   "label1",
   "label2",
   "label3",
   "label4",
   "label5"
    ],
  datasets: [
   {
    data: [
     30,
     50,
     100,
     40,
     100
     ],
    backgroundColor:[
     '#F7464A',
     '#E2EAE9',
     '#D4CCC5',
     '#949FB1',
     '#4D5360'
    ]
   }]
};

See fiddle. (this is using Chart.js 2.0)

Leave a comment