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

Vega support #182

Open
jpivarski opened this issue Sep 27, 2016 · 3 comments
Open

Vega support #182

jpivarski opened this issue Sep 27, 2016 · 3 comments

Comments

@jpivarski
Copy link

This is wonderful, except... I can't view Vega objects (https://github.com/vega/ipyvega/blob/master/notebooks/Vega.ipynb) because of

ein: [info] ein:cell-append-mime-type does not support dynamic
javascript. got: var spec = {
   ...
};
var selector = "#d6680810-6e10-4ed2-9ddc-8b96569367bb";
var type = "vega";

var output_area = this;
require(['nbextensions/jupyter-vega/index'], function(vega) {
  vega.render(selector, spec, type, output_area);
}, function (err) {
  if (err.requireType !== 'scripterror') {
    throw(err);
  }
});

Is there any hope that a future version will be able to deal with this? If so, when?

@millejoh
Copy link

Slim hope, but hope. I have an experimental branch at https://github.com/millejoh/emacs-ipython-notebook/tree/dynamic-javascript that has very basic support for running javascript using skewer. The problem, as I understand it, is that vega works by updating the DOM of the webpage it is running in - something that does not make much sense in an Emacs buffer.

My initial thought is that this might work if I can get Vega to run in headless mode and run a jpeg/svg image - something EIN knows how to handle very well.

Wish me luck. I don't get a lot of time to work on this project but agree it would be very cool feature to have.

@jpivarski
Copy link
Author

Do you suppose you could call out to nodejs? The Vega npm package has two executables, vg2png and vg2svg that can go through standard in/out. The PNG conversion uses the npm Canvas package, which requires a lot of compiled Cairo libraries, but SVG is just DOM manipulation. I think Canvas is a formal dependency for the Vega npm package, though.

@millejoh
Copy link

This is an interesting idea - wrap this in Python and the notebook will do "the right thing" as far as letting EIN know there is a image on the way. Again, work goes slowly at times but I will try to look more into doing this.

Thanks for the suggestion!

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