ResidentMario/py_d3

Have a roadmap to port it to JupyterLab?

Honghe opened this issue · 4 comments

It does not work in JupyterLab :D

(missed this issue, apologies)

JupyterLab uses a very different system AFAIK. I'm not too familiar with the internals. I'm sure this is possible with JupyterLab too, but it's not really on my radar at the moment. Maybe eventually though...will leave this issue open for now.

Here is a workaround for Jupyterlab:

%%html
<div id = "root"/>  

%%javascript
var d3Import = document.createElement('script')
d3Import.src = 'https://d3js.org/d3.v6.min.js';
d3Import.addEventListener('load', ()=>{
    d3.select('#root') 
      .html('Hello world from d3.js!');   
})
document.body.appendChild(d3Import);

image

Or

image

Here is a solution which works in both classic Notebook and JupyterLab: https://discourse.jupyter.org/t/d3-in-jupyterlab/11367/4?u=krassowski

I have officially deprecated py_d3. It's had a long and, I hope, useful life, but I believe its time has ended. 🙂

For users that want an environment to interactively develop on D3.JS visualizations, I recommend Observable Notebooks. For users that want to do this stuff in Notebooks, please see this Gist. The link from @krassowski also looks good.