Skip to content
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

Dynamically changing Vega 5 Legend "orient" #1665

Closed
roying opened this issue Mar 3, 2019 · 2 comments
Closed

Dynamically changing Vega 5 Legend "orient" #1665

roying opened this issue Mar 3, 2019 · 2 comments
Labels
enhancement For enhancement of existing features

Comments

@roying
Copy link

roying commented Mar 3, 2019

Vega v5.0.0-rc5 Legend "orient"

https://vega.github.io/vega/docs/legends/#orientation

does not seem to accept signal expressions:

"orient": {"signal": "'top'"}, // does not work
"direction": {"signal": "'horizontal'"}, // works
"columns": {"signal": "2"}, // works

Could "orient" also accept signal expressions so that the position of the entire legend can be changed during run time? The use case for this is when the chart container size changes, the legend should be allowed to change also for optimal placement.

Note: The tutorial at:

https://observablehq.com/@vega/a-guide-to-guides-axes-legends-in-vega

shows changing placement of legends using select option for

Symbol Orient and Gradient Orient

but there is not a complete example with Vega signal binding to illustrate how this can be accomplished from within the Vega v5 spec.

@jheer jheer added the enhancement For enhancement of existing features label Mar 4, 2019
@jheer
Copy link
Member

jheer commented Mar 4, 2019

Legend orient does not currently support signal values, but that can be changed fairly easily. Look for that in the official 5.0 release. However, a signal value for direction violates the schema and can not be supported: the parser uses the direction value to generate appropriate encodings at parse time. If it happened to work in your example above it is probably only because the parser assumed the direction to be horizontal by default.

@jheer jheer mentioned this issue Mar 4, 2019
@roying
Copy link
Author

roying commented Mar 4, 2019

Thanks, Jeff. That's great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For enhancement of existing features
Projects
None yet
Development

No branches or pull requests

2 participants