[Chartjs]-Border radius for the bar chart in ChartJS

1👍

Using version 3 of chart.js you can easily configure this with the borderRadius property. At the time of writing this answer you will need to install the next branch of ng2-charts since its in its 7’th release candidate for using v3 of chart.js

var options = {
  type: 'bar',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [{
      label: '# of Votes',
      data: [12, 19, 3, 5, 2, 3],
      backgroundColor: 'pink',
      borderRadius: Number.MAX_VALUE,
      borderSkipped: false,
    }]
  },
  options: {}
}

var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
  <canvas id="chartJSContainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.0/chart.js"></script>
</body>

Leave a comment