-
Notifications
You must be signed in to change notification settings - Fork 11.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
V2.0 dev tooltip refactor #1542
Conversation
Going to play with this now |
@tannerlinsley the only thing I thought of was allowing splitting lines with either |
Or they could return an array of lines.
|
They could, we'd just need to make sure we detect if the return is an array. Other than that, I think this is good to go. |
…ble tooltips. Simply return a string for a single line tooltip, or return an array to create multiple lines.
@tannerlinsley I started to write some docs on this, but ran into some issues with the labels & titles for time / linear x scales. Seeing if I can work through them today. Edit: Also seeing an issue where the points highlight for all datasets, but then tooltips only show for the single item (using the line sample as a test here) Edit2: We may also need to consider that not all items are on the same x axis. This makes highlighting all things at the same point hard if the mode is not single because we don't really know what the best title to display is (rare case, but could happen) |
Yeah I'm not sure if it was the best move but I separated the tooltip and hover modes and actions. This would make it possible to have a tooltip be based on a label or dataset but allow the user to perform actions per point or bar click. What do you think? Too much? And yes, there is a case when the label or dataset axes won't line up all together. I'm thinking at least in the time scale. In this case the scale can offer its own method to determine which points are "active" or they could just use single no matter what. Either way? |
Yeah, I think overall that's a good decision to split up the hover mode & tooltip mode. I noticed a problem with the |
Awesome. Now that I think of it. We'll probably want overrides on the scale types for some of the shared methods like getLabel and getValue. |
@tannerlinsley I already have |
…riate data based on the scale type
…time scale sample file.
Since we split up the hover and tooltips modes, both changes need to be tracked for visual updates between the two.
V2.0 dev tooltip refactor
This refactor basically deprecates the old tooltip templating system in favor a more hook-like template callback system.
Further documentation needs to be written, but basically tooltips are split up into a few parts:
-beforeTitle
-title
-afterTitle
-beforeBody
-beforeLabel, label, afterLabel
-afterBody
-beforeFooter
-footer
-afterFooter
These hooks are simple function callbacks that are passed relevant information. Each scale is equipped with built-in getters for labels and values, and a system-wide default is in place for both single and label hover modes that make the title what it is.
There is no footer by default, and all internals are discouraged from using any before or after prefixed callbacks leaving them open for users to override. Of course, users can override the main callbacks as well.
This new system will easily allow for “totalizer rows” in footers, meta information, or whatever you can imagine in the tooltip (other than images and complex data). If it’s textual, you can put it in the tooltip.