graph chart.js

0

I have this graph, how can I make it change its colors depending on whether the data is less than 50 is red and greater than 50 is blue?

var ctx = document.getElementById('chart');

var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Risk Level','risk level 1',' risk level 2'],
datasets: [
  {
    label: 'Low',
    data: [67,20,50],
    backgroundColor: '#D6E9C6',
  },
  {
    label: 'Moderate',
    data: [20,20,60],
    backgroundColor: '#FAEBCC',
  },
  {
    label: 'High',
    data: [11,5,10],
    backgroundColor: '#EBCCD1',
  }
  ]
  },
  options: {
  scales: {
  xAxes: [{ stacked: true }],
  yAxes: [{ stacked: true }]
  }
  }
  });
canvas { background-color : #eee;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.js"></script>
<body>
    <canvas id="chart" width="600" height="400"></canvas>
</body>
    
asked by JV93 20.11.2018 в 19:30
source

0 answers