Chartjs-Bars of my chartjs chart has no background color

0👍

Here is the code example based on previous comments

var mixedChart = new Chart('chart', {
  type: 'bar',
  data: {
    labels: ['< 30', '30 - 60', '61 - 90', '> 90'],
    datasets: [{
      label: "sales",
      borderWidth: '0',
      data: [40, 60, 70, 70],
      backgroundColor: ["#000000", "#000000", "#000000", "#ff0000", "#0000ff"],
    }]
  },
  options: {
    legend: {
      display: false,
    },
    barStrokeWidth: 10,
    scales: {
      xAxes: [{
        stacked: true,
        gridLines: {
          display: false,
          color: 'rgb(0, 0, 0, 0)'
        },
      }],
      yAxes: [{
        stacked: true,
        gridLines: {
          display: false,
          color: 'rgb(0, 0, 0, 0)'
        },
        ticks: {
          min: 0,
          callback: function(value) {
            return value + ',00'
          }
        }
      }]
    },
    elements: {
      line: {
        tension: 0
      }
    },
    tooltips: {
      mode: 'index',
      intersect: false
    },
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.js"></script>
<canvas id="chart"></canvas>

Leave a comment