-
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
WIP: Scriptable tooltip options #5981
Conversation
@simonbrunel @kurkle @nagix @benmccann I'd love to get your thoughts on this and whether or not you think it's moving in the right direction. I didn't want to dive too far into it without some discussion. |
When I introduced scriptable options, the idea was to keep the "context" generic, consistent, minimal and maintainable, while providing a way for users to implement whatever use cases. The scriptable context should not be designed for a specific feature and should be interchangeable (e.g. using the same function to control the color of the bar, the box in the legend or in the tooltip). That's why I think exposing #5980 is one use case and we shouldn't design scriptable options for that specific request. Your suggestion of using scriptables for the tooltip title kinda makes sense (even if there is no "loop" - thus, no different context - for the tooltip title). The context could be
This makes sense because we can generate the same context as the controller options (chart, dataset, dataIndex, datasetIndex). |
I agree that we should keep the context simple. I'm also OK to wrap the The |
@simonbrunel I improved the minification & removed the tooltip items from the context. This still needs tests and documentation. Thoughts so far? |
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.
I did not go through all the options and fallback, but overall looks good to me.
97017f6
to
774f0e9
Compare
var data = me._data; | ||
var i, len; |
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.
we usually put unitialized variables after all initialized variables, so I might move this back to where it was originally
774f0e9
to
e486419
Compare
I remember there being a report that tooltip can be slow on a chart with lots of data points. Is |
This is a WIP version of scriptable options for tooltips.
To Do
getBaseModel
function for better minification