question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let the first sector of a pie chart unfold counterclockwise

See original GitHub issue

When I create a pie chart, and I set attribute direction = "counterclockwise", I would like that the first sector can be configured to unfold counterclockwise as well.

Although I could “manually” compute the angular width of the sector and subtract it from the desired value in the rotation argument, that would still fix the first edge (in clockwise order) when I turn on/off categories in the legend, and thus the last edge would not be aligned with the desired rotation. The desired behavior would be that the last edge is fixed so that the rotation argument fixes the rotation of the first sector shown, no matter which one it is.

In this example, the first sector “a” unfolds clockwise, while the categories are plot counterclockwise from the reference direction (12 o’clock):

As a workaround, I can subtract the width of first category from the desired value for rotation; this is ok as long as all traces are active, but not when they are clicked on/off on legend:

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nicolaskruchtencommented, Dec 1, 2020

This makes sense and we’d certainly accept a pull request that added a new attribute to pie traces to control the placement of the first slice to make it work more similarly to something like Excel 😃

This attribute could be called e.g. firstslicedirection with accepted values forward and reverse (defaulting to reverse to preserve the current behaviour for existing users).

1reaction
nicolaskruchtencommented, Dec 1, 2020

I think that it’s more flexible/orthogonal to support forward/reverse with respect to the existing direction attribute, so if direction is clockwise then the reverse firstslicedirection means “counterclockwise” and vice-versa.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rotate a pie chart - Microsoft Support
Rotate a pie chart in your Office document to make it easier to make sense of ... So, let's shift the pie clockwise...
Read more >
Making Pie Charts in R
However, the default labels for the sectors of that chart are not helpful at all. There are just the ordinal number of the...
Read more >
5.4 Pie chart - Statistique Canada
Tip! When drawing a pie chart, ensure that the segments are ordered by size (largest to smallest) and in a clockwise direction. In...
Read more >
Visualization: Pie Chart - Google Developers
By default, pie charts begin with the left edge of the first slice pointing straight up. You can change that with the pieStartAngle...
Read more >
Set the Position of the First Slice in a Pie Chart - IBM
You can specify the angle in a pie chart where the first pie slice starts. You can also change the direction of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found