-
Notifications
You must be signed in to change notification settings - Fork 30
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
Plotly and HTML Widgets not working in VSCode #101
Comments
So, I don't use VSCode -- but my plan for this weekend is to install and try it, since there has been a few bugs reported. Now it seems nothing that depends on javascript is working on VSCode. Would you mind checking whether the following works in VSCode ?
Does it trigger a pop-up window in VSCode ? And if that works, does the following work as well ?
cheers, and thanks in advance! |
Btw, Apache ECharts and go-echarts look really cool also!! Let me know if you need some help. I'm expecting it to work +/- easy, just like Plotly did (being a Javascript library). Btw, just today I committed to HEAD a change to make the Plotly plots exportable from the notebook to HTML -- but I haven't yet cut a new release. Maybe we can do a new release with |
I ran your tests... the |
Apache ECharts is significantly a JSON-specified chart library, so it works great with Go's JSON marshalling -- I finally got a chance to try this out in the dockerized GoNB Jupyter Web page... the following fragment works properly! It is the go-echarts README sample with a simple modification with
|
That looks really great!! And it's great that it works in vanilla JupyterLab notebook -- which reinforces my suspicion that VSCode is not friendly to Javascript in its notebook. I'll have to check later. Question: does the HTML content generated by I ask this, because if it does, then it may be tricky to get it right for then having the plots properly exported to HTML -- not sure you care about that. This week I'm slowly fixing (it's submitted in HEAD now, no release yet) issues with HTML exporting for the Plotly installation -- see plotly code here and some of the underlying Javascript magic in LoadScriptOrRequireJSModuleAndRun. There are also the "transient" version: notebooks can have "transient" HTML/Javascript content that doesn't get saved, usually used for things that are dynamically updated while the program is running -- e.g.: I use this to display dynamic Loss/Accuracy plots while doing ML training. |
Yes, it renders it from a template that includes this header.tpl. I was pulling on some of those As I'm understanding the problem better, I see that VSCode has a specific Extension to enable rendering of Plotly and other content within the confines of its Jupyter extension. I'll peek at that more. Edit To Add: here are its supported MIME types, with multiple |
hi @neomantra , I added a doc on VSCode support for GoNB. But I confess I'm still figuring it out. Somehow after I installed Polyglot extension, Javascript output started working -- not sure if it is because of Polyglot or some other reason. And with that Plotly simply worked as well: Did you manage to use it ? I never tried the Jupyter Notebook Renderes, I actually wonder what that is ... I mean, which protocol is needed to talk to it, that is different than the standard Juptyer. I'll try to create a small wrapper for go-echarts later today or tomorrow. |
I installed the Polyglot Notebook extension, if I select ".NET Interactive" as the kernel, then each Code section has an option for one of the supported languages, but Golang is not there. Hopefully there's some traction on your issue! I then tried that latest gonb as a kernel and I'm still not getting Plotly to work. I also tried with VSCode Insiders, and also messed with trust and other things. BTW, I'm on OSX. Thanks for the docs -- putting corrected link for any newcomers: I think the Jupyter Notebook Renderers are the components that the Jupyter extension itself uses. Although I made an IPython kernel a long time ago, I'm not familiar with the modern dataflow. From the Renderers GitHub page, it seems to look at the MIME type and render it appropriately? Did you muck with the MIME types of the Plotly output at all, maybe that's why it is working? |
Noting some of my recent education: |
Thanks for the added info. So, Now vscode-notebook-renderers creates a few new mime-types, for instance for Plotly it creates Ultimately, the renderer has to call Plotly's javascript library to display. What I haven't understood yet is why VSCode blocks the mime-type The current (HEAD) wrapper of Plotly does embed the javascript in an HTML block (unwittingly made this change for other reasons), maybe that's why it's working in VSCode now. Btw, can you try adding an equivalent for you of the following cell:
This will make sure it picks up the HEAD version of |
So I created a new v0.10.0 release with the new Plotly that should work in VSCode. Let me know if it doesn't! I'll try to add |
Happy to report that the Plotly tutorial example works for me using latest! (6c87a1e). As expected, the widgets tutorial and and examples/test are spinning. Great progress, thank you!! |
Btw, I did a quick initial stab at it, in github.com/janpfeifer/gonb-echarts. It does require the |
Ok, new version Checkout the examples, it's pretty cool! I also tested in VSCode and the examples seem to be working (except one, but I think it's an issue upstream). Pls, let me know if all is good on your side and I'll close the issue -- or fix if anything goes wrong. |
Very nice work on the Echarts integration! The examples are working for me. I love the GeoMap example, I'll try adding a gonb-echarts example to my go-openchargemap project, a Golang project using Python notebooks for tutorial. I'll continue exploring these GoNB-oriented workflows... Per the initial issues, Plotly is now working in VSCode and you've well documented how everything is expected to behave. So I'll close the issue. Thanks for all this great work, it is impactful! 🙏 ❤️ |
Cool, if you have a GoNB example with go-openchargemap and ECharts, pls share, I'd love to add it to the examples page. |
I was working to add go-echarts support for GoNB -- and was using VSCode to do so. Nothing was coming up and I was confused, but then I realized I should try out the Plotly integration first.
It ends up that the Plotly integration, along with the HTML widgets, do not work in VSCode (v1.87.2 on OSX). Simple HTML like the "I ❤️ GoNB!" work fine. The SVG, images, and text input widgets also work in VSCode, but noting that the Text Input ends up via a VSCode command palette-style.
These do work on my system using inside the Docker-based Jupyter notebook within a web browser.. ,except the Animated Widget appears but doesn't seem to do anything? So I'll continue trying out Echarts there and see how it goes.
This is what the output looks like, with an empty cell and then a cell that echos some code:
I can push on this more with some guidance. Thanks for this great tool!!
The text was updated successfully, but these errors were encountered: