Fixed drawing of hole colors

This commit is contained in:
Daniel Cohen Gindi 2016-02-26 14:55:23 +02:00
parent 4b1112d2ef
commit d9c0fd76e5
2 changed files with 5 additions and 5 deletions

View file

@ -72,7 +72,7 @@ public class PieChartActivity extends DemoBase implements OnSeekBarChangeListene
mChart.setCenterText(generateCenterSpannableText());
mChart.setDrawHoleEnabled(true);
mChart.setHoleColor(Color.TRANSPARENT);
mChart.setHoleColor(Color.WHITE);
mChart.setTransparentCircleColor(Color.WHITE);
mChart.setTransparentCircleAlpha(110);

View file

@ -438,17 +438,17 @@ public class PieChartRenderer extends DataRenderer {
float radius = mChart.getRadius();
float holeRadius = radius * (mChart.getHoleRadius() / 100);
PointF center = mChart.getCenterCircleBox();
boolean hasHoleColor = mHolePaint.getColor() != 0;
if (hasHoleColor) {
if (Color.alpha(mHolePaint.getColor()) > 0) {
// draw the hole-circle
mBitmapCanvas.drawCircle(
center.x, center.y,
holeRadius, mHolePaint);
}
// only draw the circle if it can be seen (not covered by the hole), circle is independent of hole
if (mChart.getTransparentCircleRadius() > mChart.getHoleRadius()) {
// only draw the circle if it can be seen (not covered by the hole)
if (Color.alpha(mTransparentCirclePaint.getColor()) > 0 &&
mChart.getTransparentCircleRadius() > mChart.getHoleRadius()) {
int alpha = mTransparentCirclePaint.getAlpha();
float secondHoleRadius = radius * (mChart.getTransparentCircleRadius() / 100);