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

Support Altair HTML charts #44

Closed
joelostblom opened this issue Aug 13, 2024 · 5 comments
Closed

Support Altair HTML charts #44

joelostblom opened this issue Aug 13, 2024 · 5 comments

Comments

@joelostblom
Copy link

When I run Altair code, I don't see any output, not even a textual representation of the chart. For example:

import altair as alt

alt.Chart().mark_point()

image

I also tried rendering the HTML via IPython display, but the following code gives the same empty output (html text renders fine in HTML):

import altair as alt
from IPython.display import HTML

HTML(alt.Chart().mark_point().to_html())

I initially thought that this might be the same issue as coatless-quarto/pyodide#7, but there a textual output is shown which indicates that altair detected that the frontend can't render the chart and doesn't produce the HTML version of the chart. In quarto-live, it seems like the HTML version of the chart is produced, but that something is interfering with displaying it. Is this the same issue as quarto-dev/quarto-cli#3424? If so, is there anything that can be done from the altair-side of things to make support in quarto easier?

@joelostblom
Copy link
Author

Given that it seems like plotly plots are also not working as per #47, I'm thinking what I reported here is a different issue than quarto-dev/quarto-cli#3424, but it would be great to have some more insight here.

@georgestagg
Copy link
Member

Yes, I think this is related to #47, but a distinct problem.

With some manual prodding in the JS console, I can get the plot to at least display - so it is possible this can work.

Screenshot 2024-08-27 at 17 34 32

I'm going to deal with #47 first, as it will be required for this Issue too, then return here and continue to investigate.

@joelostblom
Copy link
Author

Exciting! Thank you for looking into this!

@georgestagg
Copy link
Member

As of e33a900 this should now work! I've added an example to the docs here:

https://r-wasm.github.io/quarto-live/other/py_output.html#example-altair-interactive-visualisation

I'm going to close this for now, but feel free to comment below if any particular features of Altair are broken and we can re-open to investigate :)

@joelostblom
Copy link
Author

Wohoo! That's so great to see; thanks for the quick resolution!

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

No branches or pull requests

2 participants