title: how to set the color of bar depending on value in chart.js?
body: <p>I want to set the background colour for different values of the dataset</p>
  
  <pre class="lang-js prettyprint-override"><code>var ctx = document.getElementById("myChart2").getContext("2d");
  var myObjBar = new Chart(ctx, {
    type: 'bar',
    data: {
      labels: markers[0].templabel,
      datasets: [{
  
        data: markers[0].batterytemp,
        backgroundColor: 'rgba(255, 99, 132, 0.2)',
        borderColor: 'rgba(255,99,132,1)',
        borderWidth: 1
      }]
    },
    options: {
      scales: {
        yAxes: [{
          ticks: {
            beginAtZero: true
          }
        }],
        xAxes: [{
          barThickness: 30
        }]
      }
    }
  });
  alert("welcome");
  var dataset = myObjBar.data.datasets[0];
  alert(dataset.data.length);
  var maxt = markers[0].maxt;
  alert(maxt);
  var i;
  var color;
  
  for (i = 0; i &lt; dataset.data.length; i++) {
    alert(dataset.data[i]);
  
    if (dataset.data[i] &lt; markers[0].mint) {
      alert("inside if")
  
      /* dataset.backgroundColor[i] = "red";  */
    } else {
      alert("inside elseif")
    }
  }
  
  myObjBar.update();
  </code></pre>