-
Notifications
You must be signed in to change notification settings - Fork 629
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
Support multiple conditions in an encoding (if/else/else...) #3040
Comments
You're right, currently we intentionally support only two branches, so that we can limit that one encoding channel can have only one That said, it is possible to extend the design to have multiple branches with different I could see it work with the following syntax:
where the However, we haven't prioritized it since we have not found an example visualization that would really need this. If you have a convincing use case, please feel free to submit one. For example, If you have a clear use case to have "pinned" data and "focused" data, please feel free to describe. |
That syntax looks good to me. Ok, let me describe my use case. I want the user to be able to hover the mouse over various elements in the chart, whereupon they will acquire a "focused" effect... maybe in a scatterplot they become slightly larger than the other points, for example. Then if the user clicks on an element it becomes "pinned", at which point it becomes even more emphasized... maybe in addition to being larger than the other points it acquires a red color, for example. Now as the user hovers over other items they acquire the focus effect, but not the pinned effect, so that it's clear that the old element is still pinned, whereas the things they are hovering over are only transiently focused and potentially pinnable. This chart might be accompanied by an external details view which listens only for "pin" events and shows details about the pinned element, so it needs to be clear which element that view is referring to. |
Will be fixed in #3146 (pending review) |
Correct me if I'm wrong, but it seems like currently an encoding can only take one of at most two branches, based on a single condition:
but it would be nice if one could check multiple conditions until one succeeds, e.g. something like
The text was updated successfully, but these errors were encountered: