Uh oh!
There was an error while loading. Please reload this page.
Separate tooltips for candlestick hover - #2959
Conversation
This commit adds a new attribute to ohlc and candlestick figures called 'hoveron' (as in box hover). Setting 'hoveron' to 'ohlc' shows at most 4 tooltips, for high, open, close and low. If several values should appear at the same coordinate, they are shown together in a single tooltip.
alexcjohnson
commented
Aug 31, 2018
Thanks @codrut3 - very nice!
@etpinard@chriddyp@cldougl what do you think? Do we need to keep the existing behavior (a single hover label containing all four values) and allow this as an option, or should we just switch to this version? The best argument I can think of for the existing version is if users like to be able to read off the four values in a consistent order (top to bottom open, high, low, close) but I'm not really a user of this chart type myself. To your other question:
This controls when to show spike lines, and which ones to show. Click "Toggle spike lines" in the modebar. This is different from (BTW happy Labor day 😅 - we may not hear back from other folks until next week) |
chriddyp
commented
Aug 31, 2018
Looks great! I don't really have a preference for the default behavior. |
codrut3
commented
Sep 1, 2018
Hi @alexcjohnson , Thank you for the comments! I left I also left 'points' as an option, because if the figure is small all the boxes are displayed close to one another, and it might be better to have the info in a single block. Like in the following example: Also, I didn't add the I tried with "Toggle spike lines" and it looked fine to me. I wish you a nice weekend! Enjoy Labor day! 😄 |
etpinard
commented
Sep 4, 2018
This gets my vote. Somewhat related to this PR, I've heard users on the forums wanting to show only a few selected sub-labels (e.g. q1,q3,mean) in
This brings in an interesting point. Where should we place |
codrut3
commented
Sep 5, 2018
Hi @etpinard, That's a good idea and better than what I did. Should I add a new boolean attribute hoverlabel.split? I think this will make it available for all traces. |
etpinard
commented
Sep 13, 2018
No, we don't want to make it available to all trace types. It should be available only for The way to do it is:
|
codrut3
commented
Oct 1, 2018
Hi @etpinard, I changed the attribute to |
etpinard
commented
Oct 2, 2018
Brilliant PR @codrut3 Thanks for very much 🎉 |
@codrut3 Can we have this common one tooltip for other charts as-well ?? Created a stackover-flow question for the same with code and screen shots. https://stackoverflow.com/questions/53380131/customize-tooltip-for-multiple-graphs-in-one-plot |



Hi,
I am interested in learning plotly.js and I thought I would make some contributions along the way :) I apologize if I am not following the rules properly.
This PR is for feature request #2706. I followed the suggestions in the comments and I modified the box hover code to work for ohlc and candlestick. Here is a screenshot of how it looks:
I also added a test in hover_label_test. I should say that I don't really understand everything: for example, I defined spikeDistance for the points that the functions returns, even though I am not sure how it's used.