Chartjs-How scale sector in doughnut chartjs on hover?

3👍

The simplest solution would be to define different borderWidth and hoverBorderWidth on your dataset as follows.

new Chart(document.getElementById('myChart'), {
  type: 'doughnut',
  data: {
    labels: ['red', 'green', 'gray', 'blue'],
    datasets: [{
      label: 'My First dataset',
      backgroundColor: ['red', 'green', 'gray', 'blue'],
      borderColor: 'white',
      data: [3, 4, 5, 3],
      borderWidth: 4,
      hoverBorderWidth: 0,
      borderAlign: 'center'
    }]
  },
  options: {
     responsive:true,
     cutoutPercentage: 65
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.bundle.min.js"></script>
<canvas id="myChart"></canvas>

Leave a comment