Chartjs-ChartJS row size

0👍

Here is the update JS code. which will fix the fixed row size in horizontal bar.

https://jsfiddle.net/1knt2md8/

var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
  type: 'horizontalBar',
  data: {
    labels: [
      ['Label_1_Line_1', 'Label_1_Line_2', 'Label_1_Line_3'],
      ['Label_2_Line_1', 'Label_2_Line_2', 'Label_2_Line_3'],
      ['Label_3_Line_1', 'Label_3_Line_2', 'Label_3_Line_3'],
      ['Label_4_Line_1', 'Label_4_Line_2', 'Label_4_Line_3'],
      ['Label_5_Line_1', 'Label_5_Line_2', 'Label_5_Line_3'],
      ['Label_6_Line_1', 'Label_6_Line_2', 'Label_6_Line_3'],
      ['Label_7_Line_1', 'Label_7_Line_2', 'Label_7_Line_3'],
    ],
    datasets: [{
      label: "My First dataset",
      backgroundColor: 'rgb(255, 99, 132)',
      borderColor: 'rgb(255, 99, 132)',
      data: [0, 10, 5, 2, 20, 30, 70],
    }]
  },
  options: {
    scales: {
        yAxes: [{

        maxBarThickness : 80

      }],

      xAxes: [{
       ticks: {
            mix: 0,
            max: 40,
            stepSize: 5
        }

      }]
    }
  }
});

Leave a comment