I am interested in placing javascript-enabled graphics in my jupyter laptop file as a div. This website uses a code magic approach and inserts the graph code directly into the jupyter laptop cell:
http://blog.thedataincubator.com/2015/08/embedding-d3-in-an-ipython-notebook/
However, since many of these javascript-enabled graphs are long, I think it would be easy to just call a javascript file containing the graph code, and then add it as a div in the jupyter notebook. It sounds simple enough, but with the whole crossroads of the road, I was confused by myself, and Iām not sure which approaches I tried work or not.
I tried:
%%javascript require.config({ paths: { graph: 'filepath.js' } });
This did not cause any errors, but when I could not add any divs. I think maybe the problem is how the data is connected between python and js file. The link above uses an approach that points to window.vizObj={} I wonder if there are any simpler solutions?
In addition, there is a converter library: http://mpld3.imtqy.com/ . Of course, I am not against this, but for the sake of illustration (and pride) I would like to understand this. Please feel free to share any thoughts on this.
If possible, download the jupyter laptop file so that I can see how one of them adds the js-chart to the jupyter-notepad from the js file and how the data is indicated. Any type of graph is fine, maybe a simple graph d3.js.
Arash howaida
source share