[Chartjs]-Chartjs multiple barcharts corresponding to one label

7👍

You need to arrange the data arrays of your datasets like this …

var chartData = {
   labels: Object.keys(items.dates),
   datasets: [{
      label: "Reps",
      backgroundColor: "blue",
      data: [7, 8, 3]
   }, {
      label: "Reps",
      backgroundColor: "red",
      data: [0, 9, 7]
   }, {
      label: "Reps",
      backgroundColor: "green",
      data: [0, 10, 12]
   }]
};

note: if there is no data for a particular label (date) then you’d have to add a 0 for that

Here is the working example on jsFiddle

Leave a comment