Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rotation and circumference properties to doughnut/pie charts #2271

Merged
merged 1 commit into from
Apr 16, 2016

Conversation

mdehoog
Copy link
Contributor

@mdehoog mdehoog commented Apr 16, 2016

Added two new properties to doughnut/pie charts:

  • rotation - specify the angle where the first arc starts
  • circumference - specify the total circumference angle of the chart

The arc element's inRange function had to be modified to fix tooltip support.

The chart's outerRadius value is adjusted to ensure the chart is filling all available chart area (and is offset to ensure it is centered). This is done by somewhat complex code that determines the chart's width/height assuming a radius of 1.0, and calculating a scaled outerRadius from the size. This should work for all combinations of rotation/circumference, including non right-angles.

screen shot 2016-04-17 at 12 37 54 am
screen shot 2016-04-17 at 12 39 04 am
screen shot 2016-04-17 at 12 40 41 am

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 71.416% when pulling d3a2996 on mdehoog:doughnut-rotation into 39cf4cc on nnnick:v2.0-dev.

@etimberg
Copy link
Member

@mdehoog this looks amazing!
@tannerlinsley i am +1 to merge on this

@tannerlinsley
Copy link
Contributor

I'm good to merge this!

@etimberg etimberg merged commit 1be88df into chartjs:v2.0-dev Apr 16, 2016
@mdehoog
Copy link
Contributor Author

mdehoog commented Apr 16, 2016

@etimberg @tannerlinsley thanks for the rapid merge!

Related issues that can probably be closed: #1081, #1134, #1948.

@tannerlinsley
Copy link
Contributor

You're the man!

On Sat, Apr 16, 2016 at 4:57 PM Michael de Hoog [email protected]
wrote:

@etimberg https://github.com/etimberg @tannerlinsley
https://github.com/tannerlinsley thanks for the rapid merge!

Related issues that can probably be closed: #1081
#1081, #1134
#1134, #1948
#1948.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#2271 (comment)

@etimberg
Copy link
Member

This fixed #2256 as well 😄

@leecolarelli
Copy link

This looks great! I'm in need of this now! (Currently creating graphs for a project, due date tomorrow!). Could you tell me how to use it? It seems to be present in my latest bower update, 2.0.2?

@etimberg
Copy link
Member

etimberg commented May 3, 2016

This will be available when v2.1 releases

@Drum998
Copy link

Drum998 commented Dec 7, 2017

Are there any code examples of how the charts pictured above were created? This is exactly the sort of thing I'm trying to do, with a number of different data series charted on the same doughnut. I can see how to use rotation and circumference no problem, but getting a number of similar charts with a common centre is something which is so far eluding me.

Any examples or pointers would be invaluable.

Thank you.

@Drum998
Copy link

Drum998 commented Dec 8, 2017

Sorry, I was being dense. Found all I need in the repo :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants