How to use JSROOT in a notebook?

Hi all,

I want to make use of JSROOT capabilities in ROOT notebook.
When I did the same as in the following pagehttps://root.cern.ch/notebooks/HowTos/HowTo_ROOT-Notebooks.html, I got the following:

[code]---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in ()
1 ROOT.enableJSVis()
----> 2 c.Draw()
3 ROOT.disableJSVis()

/usr/local/root/lib/ROOTaaS/iPyROOT/utils.py in _PyDraw(thePad)
368 “”"
369 drawer = CanvasDrawer(thePad)
–> 370 drawer.Draw()
371
372

/usr/local/root/lib/ROOTaaS/iPyROOT/utils.py in Draw(self)
360
361 def Draw(self):
–> 362 self._display()
363 return 0
364

/usr/local/root/lib/ROOTaaS/iPyROOT/utils.py in _display(self)
354 else:
355 if self._canJsDisplay():
–> 356 self._jsDisplay()
357 else:
358 self._pngDisplay()

/usr/local/root/lib/ROOTaaS/iPyROOT/utils.py in _jsDisplay(self)
324 # Workaround to have ConvertToJSON work
325 pad = ROOT.gROOT.GetListOfCanvases().FindObject(ROOT.gPad.GetName())
–> 326 json = ROOT.TBufferJSON.ConvertToJSON(pad, 3)
327 #print “JSON:”,json
328

/usr/local/root/lib/ROOT.pyc in __getattr2(self, name)
445
446 # reaching this point means failure …
–> 447 raise AttributeError( name )
448
449 def delattr( self, name ):

AttributeError: TBufferJSON
[/code]

How can I enable and use JSROOT in a ROOTbook? Is there anything missing in my root?

Thanks in advance,
Kazuyoshi

Hi Kazuyoshi,

you should enable the http module.
In CMAKE:

cmake /path/to/ROOT/sources [...] -Dhttp=ON

Cheers,
Danilo

Hi Kazuyoshi,

to be safer in the future, I added a clear warning message when the user tries to display a canvas or a geometry with javascript and the http module is not available.
Thanks for the report.

Danilo

Dear Danilo,

It works by adding the http support! Thank you very much for your support and the fantastic function!

Kazuyoshi