Class: HierarchyPainter

JSROOT. HierarchyPainter

new JSROOT.HierarchyPainter(name, frameid, backgr)

Painter of hierarchical structures

Name Type Description
name string

symbolic name

frameid string

element id where hierarchy is drawn

backgr string optional

background color

Example
// create hierarchy painter in "myTreeDiv"
let h = new JSROOT.HierarchyPainter("example", "myTreeDiv");
// configure 'simple' layout in "myMainDiv"
// one also can specify "grid2x2" or "flex" or "tabs"
h.setDisplay("simple", "myMainDiv");
// open file and display element
h.openRootFile("https://root.cern/js/files/hsimple.root").then(() => h.display("hpxpy;1","colz"));

Methods

applyStyle(style)

Apply loaded TStyle object

One also can specify item name of JSON file name where style is loaded

Name Type Description
style object | string

either TStyle object of item name where object can be load

Cleanup hierarchy painter

clear drawing and browser

createStatusLine(height, mode){Promise}

Create status line

Name Type Description
height number optional

size of the status line

mode optional

false / true / "toggle"

Returns:
Type Description
Promise when ready

display(itemname, drawopt){Promise}

Display specified item

Name Type Description
itemname string

item name

drawopt string optional

draw option for the item

Returns:
Type Description
Promise with created painter object

enableMonitoring(on)

Enable/disable monitoring

Name Type Description
on boolean

if monitoring enabled

executeCommand(itemname, elem, arg1, arg2){Promise}

Executes item marked as 'Command'

If command requires additional arguments, they could be specified as extra arguments arg1, arg2, ...

Name Type Description
itemname String

name of command item

elem Object optional

HTML element for command execution

arg1 optional

first optional argument

arg2 optional

second optional argument and so on

Returns:
Type Description
Promise with command result

expandItem(itemname){Promise}

expand specified item

Name Type Description
itemname String

item name

Returns:
Type Description
Promise when ready

Returns actual MDI display object

It should an instance of JSROOT.MDIDsiplay class

Returns configured layout

getMonitoringInterval()

Returns configured monitoring interval in ms

isItemDisplayed(itemname)

Returns true if given item displayed

Name Type Description
itemname string

item name

isMonitoring()

Returns true when monitoring is enabled

openJsonFile(filepath){Promise}

Open JSON file

Name Type Description
filepath string

URL to JSON file

Returns:
Type Description
Promise when object ready

openOnline(server_address){Promise}

Access THttpServer with provided address

Name Type Description
server_address string

URL to server like "http://localhost:8090/"

Returns:
Type Description
Promise when ready

openRootFile(filepath){Promise}

Open ROOT file

Name Type Description
filepath string

URL to ROOT file

Returns:
Type Description
Promise when file is opened

player(itemname, option){Promise}

Starts player for specified item

Same as "Player" context menu

Name Type Description
itemname string

item name for which player should be started

option string optional

extra options for the player

Returns:
Type Description
Promise when ready

reload(){Promise}

Reload hierarchy and refresh html code

Returns:
Type Description
Promise when completed

setDisplay(layout, frameid)

Assign default layout and place where drawing will be performed

Name Type Description
layout string

layout like "simple" or "grid2x2"

frameid string

DOM element id where object drawing will be performed

setMonitoring(interval, flag)

Configures monitoring interval

Name Type Description
interval number

repetition interval in ms

flag boolean

initial monitoring state

updateItems(arg){Promise}

Update specified items

Method can be used to fetch new objects and update all existing drawings

Name Type Description
arg string | array | boolean

either item name or array of items names to update or true if only automatic items will be updated

Returns:
Type Description
Promise when ready