1

Please help out how to set bar width for dynamic values. I want fixed width for single value:

var config = {
  type: 'bar',
  data: {
    labels: ["January"],
    datasets: [{
      type: 'bar',
      label: 'Dataset 1',
      backgroundColor: "red",
      data: [65, 4, 30, 20, 70],
    }, {
      type: 'bar',
      label: 'Dataset 3',
      backgroundColor: "blue",
      data: [-65]
    }]
  },
  options: {
    scales: {
      xAxes: [{
        stacked: true
      }],
      yAxes: [{
        stacked: true
      }]
    }
  }
};

var ctx = document.getElementById("myChart").getContext("2d");
new Chart(ctx, config);
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.0/Chart.bundle.min.js"></script>
<div style="width:600px">
  <canvas id="myChart"></canvas>
</div>
uminder
  • 23,831
  • 5
  • 37
  • 72
Haroon Ansari
  • 31
  • 1
  • 3
  • Possible duplicate of [How to modify bar width in Chartjs 2 bar charts](http://stackoverflow.com/questions/31188888/how-to-modify-bar-width-in-chartjs-2-bar-charts) – B001ᛦ Sep 20 '16 at 09:47
  • No,waht i want is totally different from this solution – Haroon Ansari Sep 20 '16 at 11:39

0 Answers0