-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
texttemplate vs hovertemplate #4263
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
Comments
Looking at #4071, I found: that discussed similar things, but nothing on axis attributes having an effect on the default I'd call this bug, axis |
Mmm... that is unfortunate indeed. The code path a value takes before reaching
I agree that the default labels should contain those 3 |
Is there any case for not declaring absolutely that they should always be equal, not just with those three properties but all properties? |
If I remember correctly, by defaults hover labels may/should have more precision than displayed text. |
I seem to recall discussing this, yes. |
All in all this is a wicked feature already :) |
@antoinerg I think I found a fix for this issue - ok if I assign myself this one? |
Sure go ahead :) Thanks for taking this on |
I probably won't have the time to make a PR to fix this bug for all traces that support There are currently four different
Fixing this bug here for bar, funnel and waterfall traces is relatively easy: we simply need to copy the plotly.js/src/traces/bar/plot.js Line 595 in fbfadbe
plotly.js/src/traces/bar/plot.js Line 601 in fbfadbe
to pie, funnelarea, sunburst and treemap appear unaffected by this bug. Their All the To fix the plotly.js/src/components/fx/hover.js Line 1424 in fbfadbe
plotly.js/src/components/fx/hover.js Line 1428 in fbfadbe
(note that To fix the plotly.js/src/traces/scatterternary/hover.js Lines 52 to 54 in fbfadbe
For the plotly.js/src/traces/scattergeo/hover.js Lines 67 to 68 in fbfadbe
... and so on. In brief, the logic here in plotly.js/src/components/drawing/index.js Lines 705 to 709 in fbfadbe
is not sufficient. Now, if we agree that the default I'm thinking either adding a new trace module method (e.g. // in scatterternary/defaults.js
trace._aFormatFn = function(cdi) { return Axes.tickText(ternary.aaxis, cdi.a, 'hover').text; }; With a bit more work, perhaps we could even generalise Oh well, having all the per-trace coordinate formatting logic in one place should be a big win. |
OK to bump to 1.52 |
Sure, but this can be done in a 1.51.x patch release also. |
Here's my WIP branch: https://github.com/plotly/plotly.js/compare/texttemplate-formatting-fixes Anyone should feel free to pull it down and add commits to it during the next two weeks. |
This pen https://codepen.io/nicolaskruchten/pen/YzzXwdL shows some differences between
texttemplate
andhovertemplate
, specifically that%{y}
intexttemplate
doesn't seem to pick up the formatting from theyaxis
ticklabels the wayhovertemplate
does.The text was updated successfully, but these errors were encountered: