Skip to content

Resize function with vega #1334

Answered by mbostock
jwilber asked this question in Q&A
May 13, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

The reason it says [object Promise] is because vl.render is async (it returns a Promise) whereas resize expects you to return a DOM element, not a promise to a DOM element. We could perhaps extend support to resize to allow async render functions (please upvote #1335 if you are interested), but that might also be surprising because you could have multiple renderings happening concurrently — generally you want rendering to be synchronous, and Vega-Lite is a bit of an outlier here.

Since Vega-Lite already supports incremental re-rendering, the best way to solve this problem is to use Vega-Lite’s reactive signals and have it re-render the chart for you as shown in the Vega-Lite responsive ba…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jwilber
Comment options

Answer selected by jwilber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn’t working
2 participants
Converted from issue

This discussion was converted from issue #1333 on May 13, 2024 20:02.