Skip to content

Pie chart pretty gradients#3764

Open
huntj88 wants to merge 4 commits intoPhilJay:masterfrom
huntj88:master
Open

Pie chart pretty gradients#3764
huntj88 wants to merge 4 commits intoPhilJay:masterfrom
huntj88:master

Conversation

@huntj88
Copy link
Copy Markdown

@huntj88 huntj88 commented Jan 29, 2018

I made the pie charts use a gradient optionally.

it takes the current color and computes a slightly darker color to use for the second color in the gradient

@huntj88
Copy link
Copy Markdown
Author

huntj88 commented Jan 30, 2018

I also would like to implement choosing a second color optionally.

I have already done this on my local computer, but I don't plan on pushing that because it doesn't really conform to how you set colors in the rest of the library. Heres a screenshot with subtle color differences

do you have any ideas about what that might look like?

float[] positions = {0, sliceAngle / 360f};
SweepGradient sweepGradient = new SweepGradient(center.x, center.y, colors, positions);

//rotate gradient so it doesn't start or the right side (0 degrees)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on*

int secondColor = Color.rgb(red, green, blue);

int[] colors = new int[2];
colors[0] = mRenderPaint.getColor();
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colors[0] = firstColor;

@almic almic added the enhancement improves upon existing functionality label May 1, 2018
@almic
Copy link
Copy Markdown
Contributor

almic commented May 3, 2018

Hey, this looks nice! I like the ability to have a gradient effect. Could you create a new pull request, with just the dual color option, so that setting the first color creates a solid color slice, and setting a second enables the gradient for the slice. I will gladly merge it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improves upon existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants