Pie chart background changes if slice is too small in MPAndroidChart

Please help me solve this problem in a pie chart using MPAndroidChart

This is a library error.

When I have a too small piece, the color for this fragment bleeds against the background of the graph. As in the figures below - you can see that the yellow color is dilapidated.

pie chart in which the background of a small piece of cake fell into the background of the review

I set the static float data to setData() : -

 private void setData(int count, float range) { yVals1.add(new Entry(100.9f, 0)); yVals1.add(new Entry(0.01f, 1)); } 

This means that entering a huge difference between the two values ​​will cause this problem. Please help me.

+6
source share
1 answer

I received an answer. For this and below: -

The problem is with slicespace --> pieDataSet.setSliceSpace(...)

If the "size" of the slice exceeds the size of the slice of the cake, this problem occurs. I suggest you remove the slice space if you have very small fragments.

You can delete this line

or

 Set---> dataSet.setSliceSpace(0.05f); 

Instead

 Set---> dataSet.setSliceSpace(3f); 

EDIT: This issue was subsequently fixed in commit 95dd249 . This should no longer be a problem if you are using the latest version of MPAndroidChart

+4
source

All Articles