-
-
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
Implement (x|y)other hovertemplate to format differing positions in compare and unified modes #5690
Conversation
How about renaming the key to |
I like One challenge I see with such a conditionally-displaying item is the spacing around it... It's OK if I put this at the end of a hovertemplate like |
We basically don't use |
ah I see. I still think it's helpful to reason about and eventually find if it contains the letter :) |
The undesirable extra spacing won't be added after ad2ad74. |
Yeah... but now you can't not-have the spacing around it if you don't want it, like if you want to have it at the beginning you'll always have a leading space when it's present. I have a slight preference for the way it was before, I was just trying to think of a way to do even better :) |
src/lib/index.js
Outdated
} | ||
|
||
if(isOther) { | ||
value = ' (' + value + ') '; |
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.
This line reminds me of ¯\_(ツ)_/¯
OK. Now with the underscore variants added in f8c8451, one could achieve desirable behaviour depending on the context. |
Clever! I like it :) |
it('should format differing position using *xother* `hovertemplate` and in respect to `xhoverformat`', function(done) { | ||
Plotly.newPlot(gd, [{ | ||
type: 'bar', | ||
hovertemplate: '%{y}%{_xother:.2f}', |
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.
hovertemplate: '%{y}%{_xother:.2f}', | |
hovertemplate: 'y(_x):%{y}%{_xother:.2f}', |
Just to make it easier to read the test output - likewise I'd suggest including the underscores in traces 3 and 4
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.
💃 Clever indeed, I like it. Just one description comment and a thought about making the tests easier to read, then this is good to go!
Co-authored-by: Alex Johnson <[email protected]>
Resolves #5555.
TODOs:
@plotly/plotly_js