-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Sunburst traces #3594
Sunburst traces #3594
Conversation
- use d3-hierarchy (for now) to help out with the logic - add special `plotly_sunburstclick` event to zoom in/out - adapt pie's transformInsideText for sunbursts' ring
... for sunburst files when reading off the d3-hierarchy output
This looks really nice! One concern, re the text, which may also apply to pies... Is it possible to control the size so it's not 'auto'? Right now I worry about the larger text calling more attention to certain slices just because the text label is smaller therefore gets scaled up. Also aesthetically is it possible to just say "do a radial layout always even if text could be bigger/more horizontal"? Or possibly "do a symmetrical layout of text"? In certain cases, symmetry will be more highly-valued than absolute maximum readability... |
yes, via
Funny, a user wrote in about that in #3590 last week. I might try to ✅ in this PR. |
OK cool, does that disable the rotations or does it still try to get the most-horizontal-that-still-fits or... ? |
no, that's what #3590 requests. |
... and use paper_bgcolor for marker.line.color dflt
First-cut transition work is on: sunburst...sunburst-transitions Here's an sample codepen: https://codepen.io/etpinard/pen/Bbpqvo, I would appreciate some feedback. Thanks! Edit: don't try clicking on a sector while a transition is happening, this part doesn't work at the moment. Thank you. |
@etpinard Sunburst will be a strong addition to plotly.js 💪 and animations do add quite a bit of wow factor 🌟 Would it be possible/easy to have the labels appear after the resizing of the sectors is done. I'm asking because the labels are sometimes out of place during the transition. For example, when going from |
WOW the sector tweens are gorgeous! nice job!! That said, I agree with @antoinerg re the text. If we can translate the text with the sector tween, it should only start to appear after the sectors have stopped moving IMO. |
Update with text-position transitions on sunburst...sunburst-transitions examples --> https://codepen.io/etpinard/pen/LayPQQ |
Text-position transition looks even better than I imagined 🎉 💪 Just superb! |
OMG so awesome! |
yeah that's gold 🏅 |
So nice @etpinard! what is double click intended to do on these? Seems to sometimes hide some of the wedges but I haven't been able to grok exactly what's going on. On second try, it's not double clicking per-say, it's that clicking on the sunburst while it's animating sometimes causes some odd behavior with wedges disappearing. Maybe disable click interactions during transitions? |
- get correct inside text contrasted color - fix text position for concentric circle sector
- tweens sector paths and text 🎉 - first-cut Plotly.animate support - calls Plotly.animate on sector click ! - disables sector clicks during transitions - trigger plotly_click on root and leaf node - clean up variable names and helpers, 1 routine to attach click and hover handlers !
Pre-vacation updateUpdated example codepen: https://codepen.io/etpinard/pen/ZPybzB I squashed all my transitions work into one large commit aa3adf3 where:
The Now, I'm thinking of removing Moreover, I'm thinking of not implementing attributes |
- to try to keep text inside sector, while keeping a transition smooth in the math sense.
- this would've been tricky to tween smoothly, most sunburst charts in the wild have text labels inside sectors only, so I didn't see the need to have this part of the first release.
... which could be moved back in if deemed necessary for the first iteration
Tagging this as |
I'm still debating with myself about this one... I don't have a compelling argument for changing it from the current default |
- add d3.hierachy error message - add appropriate tests
This is one hell of a PR 🌞 ! Amazing work @etpinard 💪 💃 💃 💃 |
Sunburst traces are coming to plotly.js 🌞
1st iteration features
marker.colors
with per-branch color inheritancebranchvalues: 'total' | 'extra'
hovertext
,hoverinfo
andhovertemplate
supportpie
-like sector coloring viasunburstcolorway
andextendsunburstcolors
pie
tracesTODOs
labels
/parents
/values
orlabel
/value
/parent
?level
/maxdepth
can anyone think of less-confusing names?branchvalues
default'total'
or'extra'
?storke-linejoin
andstroke-miterlimit
- see 1b21aaemarker.line.width: 1
the default - done in c1ccad6react
+ transitions edge casesuirevision
done in: 0da13dbThings that may be added in this PR
Plotly.react
transition API. I'll give this a try next week. THIS IS GOING IN --> aa3adf3marker.colorinheritance
attribute to offer more ways to inherit sector colorslabels
/parents
duplication when unambiguous (d3-hierarchy
is very strict)d3-hierarchy
(hierarchy
,stratify
,partition
) calls with own implementationcc @plotly/plotly_js @chriddyp @nicolaskruchten