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

Is it possible to rotate a polar chart? #524

Closed
scottmcculloch opened this issue Aug 6, 2014 · 13 comments
Closed

Is it possible to rotate a polar chart? #524

scottmcculloch opened this issue Aug 6, 2014 · 13 comments

Comments

@scottmcculloch
Copy link

I'm looking at using Chart.js for a project where I need polar charts. In my testing, with data points per chart, the orientation of the 'thirds' is such that there's segment one on bottom, and one on either side. I'd like to be able to turn that by 1 'segment' clockwise so that the segment currently on the left moves to the top with two segments below, one left, one right.

Is this possible?
If not currently, would it be difficult to implement?

Thanks,
Scott
PS. Posting here because I couldn't find where else to go for support questions. Thanks.

@scottmcculloch
Copy link
Author

Found it... had to edit chart.js and change the value for startAngle (trial and error until I got it where I wanted it).

It would be great if a future release had chart rotation as a settable parameter. :-)

@nnnick
Copy link
Member

nnnick commented Aug 11, 2014

Ah sorry haven't replied to this thus far.

So you mean customising the angle which the first segment starts right? Might be useful for pie/doughnuts too.

@scottmcculloch
Copy link
Author

Yes, exactly. I agree, it would also likely be useful for pie/doughnuts.

@fulldecent
Copy link
Contributor

Hello, this issue looks like a QUESTION regarding the Chart.js API. It would be very helpful if you could please create an example chart showing your attempt, and even call the methods that don't exist yet which you are expecting to be there. A mockup here of what the result should look like would be for bonus points.

To help, I have created a simple JSBIN which you could fork:
http://jsbin.com/yozobahucero/1/edit?html,js,output

Sorry that this response is templated as we are triaging many issues and ones with test cases will be seen first.

@scottmcculloch
Copy link
Author

Hi,
I'm not quite sure what to do with the JSBIN...

To achieve what I wanted, I had to edit the chart.js or chart.min.js file itself.

I had to change startAngle to "Math.PI * 1.5" (the original value is 1.835)

So, I guess what I mean is for there to be a way to have startAngle as a settable parameter so that it can be adjusted for each instance of a polar graph rather than fixed for all instances. Also, this would protect against "breaking" a graph when upgrading chart.js

Unfortunately, I'm not actually a developer, so my knowledge of how to do this is limited (it took a LOT of searches and then trial and error to figure out what to change in chart.min.js to get what I wanted).

@scottmcculloch
Copy link
Author

What I wrote above was incorrect - I think I got it backwards... had to change the value of startAngle to 1.835*Math.PI

I've done some more looking through the code, and found that I can just replace the values set for startAngle with this.options.startAngle allows me to now set the startAngle in the parameters of my individual charts. Exactly what I need since now I'm doing additional polar charts that need different amounts of rotation.

@5herah
Copy link

5herah commented Nov 13, 2014

I would love this option to be settable too.

@Patatouf
Copy link

Hi,
I would like to make a "1D" chart. I can more or less achieve this goal by making a radar chart with "only one direction" but the size of the graphe and the center of the line are not correct. More over I want this chart to be horizontal and I can't find a way to make it work. Where could I find help for that?
Thx for your help :)

@Cumquat
Copy link

Cumquat commented Jun 1, 2016

Hi ya, any news on this enhancement, i have a current project that i would like to use this on?
Cheers Mick.

@etimberg
Copy link
Member

etimberg commented Jun 1, 2016

This is not yet done for the polar area chart, but it is done for the doughnut chart. It won't be too hard to implement

@Cumquat
Copy link

Cumquat commented Jun 1, 2016

Sorry my mistake i meant to actually tag this comment on the ability to rotate the Radar Chart type, my mistake.

@etimberg
Copy link
Member

etimberg commented Jun 1, 2016

No problem, I think the fix is pretty much the same for both

@etimberg
Copy link
Member

Fixed in #2947 and releasing in v2.2.0

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

No branches or pull requests

8 participants