canva-public / flourishcharts

Interactive data visualization Python and R packages for data scientists.
20 stars 1 forks source link

Can't set height of a flourish visualization in Quarto html #10

Open maartenzam opened 6 days ago

maartenzam commented 6 days ago

I tried to set the height of an embedded viz with set_line_bar_pie_details(height_mode = "aspect") but that is not working.

The docs say This setting is ignored when embedded in a fixed-height context, such as a simple iframe embed, so does this mean there is no way to set the height when outputting to Quarto html?

Thanks!

zmeers commented 6 days ago

For reasons that now escape me, we hard-coded the height of the widget when knitting to HTML (see here: https://github.com/canva-public/flourishcharts/blob/44128e03dc7444d111e2aaa18a0e013ae4a4bb9f/R_package/R/flourish.R#L126) But I think this can likely vary according to the user-defined fig.width and fig.height for the document/code chunk. @maxious Would you mind noting this in the internal channel please?

zmeers commented 6 days ago

@maartenzam Just to confirm, are you using the R package? I'm working in a Quarto file right now with the Python package open and this isn't an issue for Python -- at least I can't replicate it.

It's a bit odd but a workaround could be to set the engine to the R kernel in jupyter instead of knitr.

maartenzam commented 5 days ago

Yes, I am using the R package.