Reputation: 21
How do I make the slices in an MPAndroid pie chart a gradient?
I see the methods:
dataset.setGradientColor
dataset.setGradientColors
But I'm not sure how to use them.
Upvotes: 1
Views: 681
Reputation: 286
Adding two colors for a single gradient:
dataSet.setGradientColor(Color.WHITE,Color.LTGRAY); //Start and End Colors
Adding multiple colors as a single gradient:
List<GradientColor> gradientColors=new ArrayList<>();
gradientColors.add(new GradientColor(Color.BLUE,Color.parseColor("FFFFFF")));
gradientColors.add(new GradientColor(Color.WHITE,Color.BLUE));
gradientColors.add(new GradientColor(Color.BLUE,Color.LTGRAY));
dataSet.setGradientColors(gradientColors);
Upvotes: -1