-
-
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
Fix uniformtext and enable coloraxis for sunburst and treemap as well as pathbar.textfont #4444
Conversation
- fix clear previous uniformtext scale before each plot - fix uniformtext after switch level when has no transition for sunburst and treemap - fix tests and add new tests
@@ -91,6 +91,9 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) | |||
gap: fullLayout.bargap, | |||
groupgap: fullLayout.bargroupgap | |||
}; | |||
|
|||
// don't clear bar when this is called from waterfall or funnel | |||
clearMinTextSize('bar', fullLayout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait. Here you're clearing the min-text-size stash during the plot step. So what's happens when a style-only edit (e.g. Plotly.restyle(gd, 'marker.color', 'red')
) gets called?
To me, this logic should probably be somewhere in the calc step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restyle works. Considering interactions (e.g. zoom and selection) this should be cleared after calc and at the stat of plot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering interactions (e.g. zoom and selection) this should be cleared after calc and at the stat of plot.
Can you explain a bit more here? To me, sounds like we should not clear minTextSize
during zoom interactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or let me rephrase my question: if you do move clearMinTextSize
to the calc step, do any of the tests fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. In that case the react tests would fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share the branch you used to test that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summing up a private convo:
- I was under the impression that the
uniformtext
attributes wereeditType: 'calc'
, so that's why I thought it would be best to clear the min-text-size during the calc step, but they're not. Theuniformtext
attributes areeditType: 'plot'
. - @archmoj says that making the
uniformtext
attributeseditType: 'calc'
would have an impact on the way graph with set uniformtext would behave on zoom - Since we'll need to refactor the trace text pipeline at some point (more info in Consistent text mode for bar-like & pie-like traces and feature to control text orientation inside pie/sunburst slices #4420 (comment)), let's keep the clear-min-text logic in the plot step for now.
- The most important of this PR are the newly added tests.
function transition(selection, opts, makeOnCompleteCallback) { | ||
if(hasTransition(opts)) { | ||
function transition(selection, fullLayout, opts, makeOnCompleteCallback) { | ||
if(!fullLayout.uniformtext.mode && hasTransition(opts)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? I thought you said this transitions looked fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They did not apply a uniform text size during and after smooth transition.
…burst and treemap
…textfont - fixing issue 4451
@@ -141,7 +141,9 @@ module.exports = function drawAncestors(gd, cd, entry, slices, opts) { | |||
s.attr('data-notex', 1); | |||
}); | |||
|
|||
var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font, trace.pathdir)); | |||
var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font, { | |||
onPathbar: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why this commit made three existing mocks change (treemap_level-depth
, treemap_packings
and treemap_textposition
) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question.
And a bad mistake here.
There is no such a thing as pathdir
!
It should have been written pathbar
.
…r positions - also revise code related to autorotate
After a9c9589 this PR is now ready to go. |
Here is info related to new/modified baselines:
treemap trace custom fonts bug fix (#4451)
treemap coloraxis with values as well as custom fonts and uniformtext (#4443):
uniform start/end anchor positions in respect to (#4247):
modified mock: middle anchors is not used now that the text positions properly by default
|
💃 💃 |
Resolves #4443 by adding
coloraxis
tosunburst
andtreemap
and fixes
uniformtext
scale issues with react (follow up of #4420):sunburst
andtreemap
uniformtext
as well as newcoloraxis
feature.Also:
pathbar.textfont
bug in 6a4b451textangle
bug in 2a7721cdemo treemap
demo sunburst
demo bar
@plotly/plotly_js