plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

enable rotation of sunburst plots to change starting point

Open bishonen opened this issue 5 years ago • 6 comments

Hi,

adding the option to decide at which angle the sunburst chart starts would be a nice feature. Currently the first slice is rendered at 90 degrees.

bishonen avatar Apr 03 '20 14:04 bishonen

@bishonen In terms of roadmap, at the moment we aren't planning on working on this for the next few months, but if anyone here works for an organization that has a software budget, we do accept sponsorship for features, which would enable us to build this feature faster :)

archmoj avatar Apr 07 '20 19:04 archmoj

+1 for this request.

Moving away from Highcharts, where this option is avaible.

thierryVergult avatar Sep 18 '20 19:09 thierryVergult

The code to modify the angle is found in ./traces/sunburst/plot.js

        pt.rpx0 = y2rpx(pt.y0);
        pt.rpx1 = y2rpx(pt.y1);
        pt.xmid = (pt.x0 + pt.x1) / 2;
        pt.pxmid = rx2px(pt.rpx1, pt.xmid);
        pt.midangle = -(pt.xmid - Math.PI / 2);
        pt.startangle = -(pt.x0 - Math.PI / 2);
        pt.stopangle = -(pt.x1 - Math.PI / 2);
        pt.halfangle = 0.5 * Math.min(Lib.angleDelta(pt.x0, pt.x1) || Math.PI, Math.PI);
        pt.ring = 1 - (pt.rpx0 / pt.rpx1);
        pt.rInscribed = getInscribedRadiusFraction(pt, trace);

Adding a value (in radians) to x0 & x1 worked for my 1st test

... pt.x0 = pt.x0 + (Math.PI / 2); // adding 90 degrees to x0 pt.x1 = pt.x1 + (Math.PI / 2); // adding 90 degrees to x1

    pt.rpx0 = y2rpx(pt.y0);
    pt.rpx1 = y2rpx(pt.y1);
    pt.xmid = (pt.x0 + pt.x1) / 2;

...

I will explore how to turn this in a configuration option.

thierryVergult avatar Sep 20 '20 14:09 thierryVergult

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

gvwilson avatar Jun 24 '24 13:06 gvwilson

i'd be happy to sponsor this feature with 100 USD

janosh avatar Jun 24 '24 13:06 janosh

THanks @janosh - I'll see if I can find someone to do the work.

gvwilson avatar Jun 24 '24 13:06 gvwilson