I am trying to load the latest version of D3JS in a Jupyter notebook using a Python Kernel,
so I can use D3 in the subsequent cells that contain javascript code executed via %%javascript cell magic.
So I am doin something like this in a cell
import json
from IPython.core.display import HTML,Javascript
HTML(
'''
<script src="https://d3js.org/d3.v7.js"></script>
'''
)
str1="<nodedata>"+json.dumps(json_lab['nodes'])+"</nodedata>"
str2="<linkdata>"+json.dumps(json_lab['links'])+"</linkdata>"
HTML(str1+str2)
Javascript('console.log(d3)')
However I get this response showing an older version there
"This is the way" d3.js Loading version 3 vs version 4 in Jupyter Notebook
%%javascript
requirejs.config({
paths: {
d3: 'https://d3js.org/d3.v7'
}
});
require(['d3'], function(d3) {
window.d3 = d3;
});