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

Add support for Juno MIME type #257

Merged
merged 1 commit into from
Jan 15, 2020
Merged

Add support for Juno MIME type #257

merged 1 commit into from
Jan 15, 2020

Conversation

davidanthoff
Copy link
Member

@davidanthoff davidanthoff commented Jan 14, 2020

Fixes #90.

Except, it doesn't :) As far as I can tell this seems to work on the VegaLite.jl side of things, but then nothing shows up in Juno. @pfitzseb, any idea?

The code right now emits a full HTML document, i.e. including a starting <html> tag. Do we maybe just need a fragment?

PS: Oh, and testing this is kind of painful because Atom.jl/Juno.jl seems to downgrade a lot of my other stuff... I think it is because it require CSTParser <2?

@pfitzseb
Copy link

Yeah, turns out we weren't properly escaping the html before passing it as a data url...

Once that's fixed on our side interactivity seems to work fine:
image
(that was the only example I could find that seems like it should have some interactivity)

@davidanthoff
Copy link
Member Author

Cool!

There is one more twist we might try: right now the whole vega and vega-lite javascript gets embedded into the HTML that we emit that way. It works, but it makes the HTML large. I think for the Juno plot pane we could just link to javascript files on disc that ship with VegaLite.jl, right? The HTML that we emit that way wouldn't be portable, but when it is displayed in Juno that wouldn't be a problem, it wouldn't be saved and used for anything else?

@pfitzseb
Copy link

I think for the Juno plot pane we could just link to javascript files on disc that ship with VegaLite.jl, right?

In theory yes, but in practice I'd rather not disable websecurity to make it possible to load files from disk (just in case someone wants to load an actual webpage). Size isn't really an issue -- data urls are only limited by system memory, IIRC.

@pfitzseb
Copy link

Btw, do you think it would make sense for VegaLite.jl to take hints regarding the display size (if that's not specified in the spec, that is)? Juno passes the relevant info along with the io object (and VSCode and ElectronDisplay could do that too).

@davidanthoff
Copy link
Member Author

Great, then I think I'll just merge this here!

Re size: a vega (and vega-lite) plot can either have a set size, or automatically adjust to the width/height of its container, that is specified in the spec itself. We are currently fiddling with getting the latter right (see here), but I think in either situation we wouldn't need to adjust anything in the show method, now that we ship the full vega and vega-lite spec to Juno itself.

@davidanthoff davidanthoff merged commit f038e9a into master Jan 15, 2020
@davidanthoff davidanthoff deleted the juno branch January 15, 2020 20:04
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

Successfully merging this pull request may close these issues.

Improve Juno integration
2 participants