-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[BUG] polarArea angleLines don't align with data borders #5907
Comments
Chart.js/src/scales/scale.radialLinear.js Lines 453 to 457 in 69fcba0
|
Thanks for the hint @nagix. It does seem that the entire issue is isolated to the |
I see the related #5919 is closed. But it looks like the issue I opened is still present in 2.8.0? Updated Fiddle to 2.8.0: |
Workaround: Instead of using -Math.PI/2 as startAngle, use 2 * Math.PI * 1891 - Math.PI/2 This solution works well but makes little time-lag. |
Updated Fiddle to 2.9.3: |
Good news! This appears fixed in v3.0.0-alpha. As part of v3, the startAngle setting has been normalized and now defaults to 0. https://jsfiddle.net/q6mbjny4/ |
Expected Behavior
Enabling the angleLines for a polarArea type chart should draw angleLines that align with the borders of a data segment.
Current Behavior
Data segment borders appear to be rendering at the correct (default) startAngle, but angleLines of the chart are about -1 degree off.
Possible Solution
Not a solution but my current workaround is this:
Since you can't change the
startAngle
of theangleLines
, instead I change theoptions.startAngle
of the polar area chart data to-0.509 * Math.PI
(which makes it crooked, but aligned with the angleLines) and then also set a CSS transform (oftransform: rotate(1.5deg)
) onto the canvas element itself to rotate the chart back to vertical. (See commented out parts of the jsfiddle)Charts exported with
toBase64Image()
are still crooked, since the CSS doesn't apply to them.Steps to Reproduce (for bugs)
https://jsfiddle.net/8tn903pj/
Context
I need to be able to identify empty data segments on the polar area chart, so I need to show the angleLines.
Environment
The text was updated successfully, but these errors were encountered: