score:0

the colors of my dataset were inside brackets, that was causing it to be taken as an array, i left only the value.

i hope this helps someone else.

              
var ctx = document.getelementbyid("mychart")

var mychart = new chart(ctx, {
	type: "bar",
  data: {
  labels: ['product 1','product 2','product 3','product 4','product 5','product 6'],
    datasets: [{
      label: 'count 1',
      data: [10,2,2,2,0,1],
      backgroundcolor: 
        'rgba(255, 99, 132, 0.2)'
    }, {
      label: 'count 2',
      data: [10,5,1,0,5,4],
      backgroundcolor: 
        'rgba(54, 162, 235, 0.2)'
    }]
  },
  options: {
    scales: {
      xaxes: [{
        stacked: true
      }],
      yaxes: [{
        stacked: true,
      }]
    }
  }
});
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.7.3/chart.min.js"></script>
</head>

<canvas id="mychart"></canvas>

attached link in jsfiddle

https://jsfiddle.net/espinoza/uzjyrfv2/1/


Related Query

More Query from same tag