chartist icon indicating copy to clipboard operation
chartist copied to clipboard

Stroke width bug when override draw event function in Pie Chart

Open ravillarreal opened this issue 4 years ago • 0 comments

When setting the donutWidth parameter to the value 30 the actual stroke-width of the donut is not 30px. Causing the donut expand out of the container div

This happens only when you override the draw event function

https://codepen.io/ravillarreal/pen/dyMWaRd

Try changing the donutWidth option and you'll see the actual stroke-width is incorrect

Of course you could solve this by setting a custom stroke-width inside the draw event like this

chart.on('draw', function(context) {
  if (context.type === "slice") {
    context.element.attr({
      style: "stroke-width: 30px;"
    });
  }
})

ravillarreal avatar Aug 28 '20 04:08 ravillarreal