Using JSVis offline update

Hi,
I was in a place with no internet connection. There I found that if I use
ROOT.enableJSVis()
in a jupyter notebook I can not see the histograms. The problem and a solution is described in:

I thought it may be interested to get some feed back as the discussion was not completed. The concept suggested by Bertrand worked very nice.

The jupyter notebook provides the web server. As I want to have the possibility to run all my notebooks offline, here is what I ended with:

  1. cloned the jsroot repository

  2. add the path to the directory with jsroot in: .jupyter/jupyter_notebook_config.py
    c.NotebookApp.extra_static_paths = ['path_to_jsroot ']

  3. In JupyROOT/helpers/utils.py added a function:

def setJSRootSourceDir(jsROOTSourceDir = "https://root.cern.ch/js/notebook/"):
    global _jsROOTSourceDir
    _jsROOTSourceDir = jsROOTSourceDir

and in enhanceROOTModule() added:
ROOT.setJSRootSourceDir = setJSRootSourceDir

Now in a notebook I can enable JSVis offline or using a diffferent servers than root.cern.ch/js/notebook:

ROOT.enableJSVis()
ROOT.setJSRootSourceDir('http://localhost:8888/static')

Alternately one can put the jsroot in the directory with the notebook and skip step 2, calling:
ROOT.setJSRootSourceDir('http://localhost:8888/notebooks/jsroot')

In general it may be useful to have the ability to control form where the java scripts are pulled.

Best regards,
Plamen


_ROOT Version: 6.16/00
_Platform: Linux/Arch-Manjaro
_Compiler:gcc 8.3.0


Hi,

https://root.cern.ch/js/notebook/ was used for convenience - during development phase it was changed very often. Now one can safely use JSROOT version delivered with ROOT. I hope, it should be not a big deal to instruct Jupyter web-server to provide access to JSROOT from $ROOTSYS/js.

I just open correspondent JIRA request - https://sft.its.cern.ch/jira/browse/ROOT-10116

Regards,
Sergey

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Hi,

Finally code in the ROOT master - you could try it now.
See https://github.com/root-project/root/pull/4497

Regards,
Sergey