-
Notifications
You must be signed in to change notification settings - Fork 623
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
feat: add filter and sort support for tooltips #9148
base: main
Are you sure you want to change the base?
feat: add filter and sort support for tooltips #9148
Conversation
Thanks for the pull request. Can you explain the reasoning for his change and the proposed API changes in the description of the pull request? Please also highlight the changes in the specs and format them to be readable. I don't think I can quite follow the suggestion here. Once we have reviewed the API proposal, please make sure the tests and CI runs pass. |
Is this supposed to fix #9152? If so, please reference the issue in the description. |
I think we need a more detailed API proposal in #9152. I added comments there. Let's put this pull request on hold until we resolved the API discussion. |
…fire a schema validation warning.
Parameter signatures:
Filter - added as a parameter for each tooltip object in the tooltip array:
{"field": "type1", "type": "quantitative", "**filter**": {"operator": ">", "literal": 0}
Sort - added as a parameter for
encoding
:"encoding": { "opacity": { "condition": { "empty": false, "param": "param_46", "value": 0.2 }, "value": 0 }, "size": { "value": 4 }, "tooltip": [ { "field": "Date", "type": "nominal" }, { "field": "type1", "type": "quantitative" }, { "field": "type2", "type": "quantitative" }, { "field": "type3", "type": "quantitative" }, { "field": "type4", "type": "quantitative" }, { "field": "type5", "type": "quantitative" }, { "field": "type6", "type": "quantitative" }, { "field": "type7", "type": "quantitative" }, { "field": "type8", "type": "quantitative" } ], "**sort_tooltip**": {"value": "descending"}, "x": { "field": "Date", "title": null, "type": "ordinal" } }, "mark": { "type": "rule" }, "params": [ { "name": "param_46", "select": { "clear": "mouseout", "fields": [ "Date" ], "nearest": true, "on": "mouseover", "type": "point" } } ]
Original vega-lite specification:
With filter:
With sort:
With filter & sort:
To make the new parameters robust, both filter & sort_tooltip can only be some enum values.
filter.operator: one of '==', '!=', '<', '<=', '>', '>='
filter.literal: one of type string, number or boolean.
"filter": {"operator": "><", "literal": 0}
:sort_tooltip.value: 'ascending' or 'descending' only:
"sort_tooltip": {"value": "whatever"}
PR to vega-tooltip: vega/vega-tooltip#820
This along with vega/vega-tooltip#820 are to fix #9152
cc: @joelostblom @jakevdp @kanitw @domoritz @arvind @jheer