ResidentMario / py_d3

D3 block magic for Jupyter notebook.
MIT License
451 stars 40 forks source link

Have a roadmap to port it to JupyterLab? #16

Closed Honghe closed 2 years ago

Honghe commented 6 years ago

It does not work in JupyterLab :D

ResidentMario commented 6 years ago

(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.

stefaneidelloth commented 3 years ago

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

krassowski commented 2 years ago

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

ResidentMario commented 2 years ago

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.