-
-
Couldn't load subscription status.
- Fork 1.9k
Text template formatting fixes #4380
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- note also the fix texttemplate test case
... with appropriate edit in legend trace clone
... in an effort to bring texttemplate and hover coordinates
formatting to the same place.
... by calling `_module.formatLabels` during Drawing.textPointStyle.
This way, prefixes and suffixes render correctly in texttemplate
text and minus signs now show up correctly.
... using a new formatLabels method. Notice that now the minus
sign render correctly.
... by adding a formatLabels method. The result is a bit hackier
than for the SVG trace types as we have to juggle with calcdata
mocks. Note also that text templates are formatting during the
calc step for scattergl and scatterpolargl which may cause
some issues down the road. I didn't notice anything in this
iteration, but we should probably move the text templates
formatting down to the plot step down the road.
... w/o using a formatLabels method here, as gl3d hover
does not use `_module.hoverPoints` and the formatting logic
for scatter3d is fairly trivial, so this here should suffice
until we refactor the gl3d hover pipeline.
etpinard
added a commit
that referenced
this pull request
Nov 25, 2019
... post texttemplate fix of
#4380
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #4263 - a follow-up of #4071
Expanding on the info from #4263 (comment)
There are four different
texttemplate"pathways" used currently:Lib.texttemplateStringinsidebar/plot.jsLib.texttemplateStringfrom theirformatSliceLabelroutineDrawing.textPointStyleviaScatter.styleTextLib.texttemplateStringin their "convert" stepFixing this bug here for bar, funnel and waterfall traces is relatively easy. This is done in 7717428. Commit 89422ba fixes a similar bug affecting
hovertemplate.Pie, funnelarea, sunburst and treemap are unaffected by this bug. Their
texttemplateformatting appears equivalent to theirhovertemplateformatting.All the
scatter*traces are currently affected.To fix the
scattercase, we need to passxLabelandyLabeltoLib.texttemplateStringas formatted byAxes.tickTextsimilarly to how we fill inxLabelandyLabelduring hover. To fix thescatterternarycase, we'll need to passaLabel,bLabelandcLabel.For the
scattergeo,lonLabelandlatLabeland so on ...To do so, I added a new trace module method called
formatLabelswhich is meant to be called during hover and when building up the available labels fortexttemplate. This is done in 76d8a11 and the newDrawing.textPointStyleis implemented in 04503ea along with new tests.before: https://codepen.io/etpinard/pen/MWWRQqQ
after: https://codepen.io/etpinard/pen/qBBwxMv
Fixing
scattergl,scatterpolargl,scattermapboxandscatterglwas a bit more tedious. Please refer to the commit messages in 493ee75, acbd0de and 2278910 for the details.@plotly/plotly_js I'd like to release this in next week's
v1.51.2.Maybe
texttemplateauthor @antoinerg could review this one?