MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

PieChart - add slice space on highlight when touching.

Open congdanh1608 opened this issue 5 years ago • 2 comments

Hi everyone! I am working with PieChart. I want to make the highlight has slice space when touching on pie. like the example image on home page

image

The SliceSpace of PieChart = 0, But I couldn't found how to add slice space when touching like this image. I also check the drawHighlighted(), but it look very complex for me.

Thanks for help.

congdanh1608 avatar Nov 29 '19 04:11 congdanh1608

@congdanh1608 Hi, did you manage to achieve this?

sauravmunankarmi avatar Apr 29 '22 08:04 sauravmunankarmi

to anyone who needs it in future, I managed to get this result by using a customPieChartRenderer that extends PieChartRenderer.

I copied the original onHighlight func in PieChartRenderer and overrode it on customPieChartRenderer and pasted the original function with one minor change

I changed the line : val sliceSpace = if (visibleAngleCount <= 1) 0f else set.sliceSpace to: val sliceSpace = if (visibleAngleCount <= 1) 0f else {desired slice spacing in float}

sauravmunankarmi avatar May 02 '22 08:05 sauravmunankarmi