score:1

Accepted answer

yes this is possible by using the scriptable option for borderwidth like this:

var options = {
  type: 'pie',
  data: {
    labels: ["red", "blue", "yellow", "green", "purple", "orange", "f", "d"],
    datasets: [{
      label: '# of votes',
      data: [12, 19, 3, 5, 2, 3, 0, 0],
      borderwidth: (a, b, c) => (a.dataset.data[a.dataindex] === 0 ? 0 : 1),
      backgroundcolor: ["red", "blue", "green", "yellow", "pink", "purple", "white", "black"],
      bordercolor: ["red", "blue", "green", "yellow", "pink", "purple", "white", "black"]
    }]
  },
  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/2.9.4/chart.js" integrity="sha512-hzf9qhp3rldjbvakvmig+goaakrza6lkuo35ok6esm0/kjpk32yw7urqrq3q+nvbbt8usss+iekl7crn83dymw==" crossorigin="anonymous"></script>
</body>

if you change borderwidth: (a,b,c) => (a.dataset.data[a.dataindex] === 0 ? 0 : 1), to borderwidth: (a,b,c) => (a.dataset.data[a.dataindex] === 0 ? 10 : 1), you can see the old behaviour you have now.


Related Query

More Query from same tag