Members
(private, constant) AxisPainterMethods
Base axis painter methods
- Source:
(private, constant) Box3D
Help structures for calculating Box mesh
- Source:
(private, constant) CustomStreamers
Custom streamers for root classes
- Description:
map of user-streamer function like func(buf,obj) or alias (classname) which can be used to read that function or list of read functions
- Source:
map of user-streamer function like func(buf,obj) or alias (classname) which can be used to read that function or list of read functions
(private, constant) DirectStreamers
these are streamers which do not handle version regularly
used for special classes like TRef or TBasket
(private, constant) FrameInteractive
Set of frame interactivity methods
- Source:
(private) _ensureJSROOT
Ensure global JSROOT and v6 support methods
(private, constant) atob_func
atob function in all environments
(private) batch_mode
Is batch mode flag
(private, constant) browser
browser detection flags
(private, constant) btoa_func
btoa function in all environments
(private, constant) drawFuncs
list of registered draw functions
(private) first_hpainter
Current hierarchy painter
- Description:
Instance of
HierarchyPainter
object
- Source:
Instance of HierarchyPainter
object
(private) gbl_colors_list
list of global root colors
- Source:
(private, constant) geoBITS
TGeo-related bits
- Source:
(private, constant) internals
internal data
(private, constant) k_upper_pad
Painter class for TRatioPlot
- Source:
(private, constant) latex_features
array defines features supported by latex parser, used by both old and new parsers
- Source:
(private, constant) methodsCache
variable used to keep methods for known classes
(private, constant) nodejs
Is node.js flag
(private, constant) prJSON
Standard prefix for JSON file context as data url
- Source:
(private, constant) prSVG
Standard prefix for SVG file context as data url
- Source:
(private) source_dir
Location of JSROOT modules
- Description:
Automatically detected and used to dynamically load other modules
- Source:
Automatically detected and used to dynamically load other modules
(private, constant) symbolsRegexCache
Create a single regex to detect any symbol to replace, apply longer symbols first
- Source:
(constant) version
version id and date
- Description:
Produced by concatenation of
version_id
andversion_date
Like '7.0.0 14/04/2022'
- Source:
Produced by concatenation of version_id
and version_date
Like '7.0.0 14/04/2022'
(constant) version_date
version date
Release date in format day/month/year like '14/04/2022'
(constant) version_id
version id
- Description:
For the JSROOT release the string in format 'major.minor.patch' like '7.0.0'
- Source:
For the JSROOT release the string in format 'major.minor.patch' like '7.0.0'
Methods
(private) BIT(n) → {Number}
Generate mask for given bit
Parameters:
Name | Type | Description |
---|---|---|
n |
number | bit number |
Returns:
produced mask
- Type
- Number
(private) DirectStreamers[undefined]()
Direct streamer for TBasket,
(private) HMAC()
HMAC implementation
- Description:
see https://en.wikipedia.org/wiki/HMAC for more details
- Source:
(private) LZ4_uncompress(input, output) → {Number}
Decode a block.
- Description:
Decode a block. Assumptions: input contains all sequences of a chunk, output is large enough to receive the decoded data. If the output buffer is too small, an error will be thrown. If the returned value is negative, an error occurred at the returned offset.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
input |
Buffer | input data |
output |
Buffer | output data |
Returns:
number of decoded bytes
- Type
- Number
(async, private) R__unzip() → {Promise}
Reads header envelope, determines zipped size and unzip content
Returns:
with unzipped content
- Type
- Promise
(private) _getTF1Save()
Get interpolation in saved buffer
- Description:
Several checks must be done before function can be used
- Source:
(async, private) _loadJSDOM() → {Promise}
Load and initialize JSDOM from nodes
- Source:
Returns:
with d3 selection for d3_body
- Type
- Promise
(private) add3DMesh()
Add 3D mesh to frame painter
- Source:
(private) addClassMethods()
Let directly assign methods when doing I/O
(private) addColor(rgb, lstopt) → {number}
Add new color
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
rgb |
string | color name or just string with rgb value |
|
lst |
array |
<optional> |
optional colors list, to which add colors |
Returns:
index of new color
- Type
- number
(private) addCustomFont()
Register custom font
- Source:
(private) addDragHandler()
Add drag for interactive rectangular elements for painter
- Source:
(protected) addDrawFunc(args)
Register draw function for the class
- Description:
List of supported draw options could be provided, separated with ';'
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | arguments Properties
|
(private) addHighlightStyle()
Configure special style used for highlight or dragging elements
- Source:
(private) addMethods(obj, typenameopt)
Adds specific methods to the object.
- Description:
JSROOT implements some basic methods for different ROOT classes.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
object | object where methods are assigned |
|
typename |
string |
<optional> |
optional typename, if not specified, obj._typename will be used |
(private) addMoveHandler()
Add move handlers for drawn element
- Source:
(private) addStreamerInfosForPainter()
Scan streamer infos for derived classes
addUserStreamer()
Add custom streamer
(private) adoptRootColors()
Set global list of colors.
- Description:
Either TObjArray of TColor instances or just plain array with rgb() code. List of colors typically stored together with TCanvas primitives
- Source:
(private) afterRender3D()
Post-process result of rendering
- Description:
used together with SVG or node.js image rendering
- Source:
(private) applyAttributesToMathJax()
Apply attributes to mathjax drawing
- Source:
(private) approximateLabelWidth()
Calculate approximate labels width
- Source:
(private) assign3DHandler()
Assigns method to handle 3D drawings inside SVG
- Source:
(private) assignContextMenu()
Assign handler for context menu for painter draw element
- Source:
(private) assignFrame3DMethods()
Assign 3D methods for frame painter
- Source:
(private) assignRAxisMethods()
assign methods for the RAxis objects
- Source:
(private) before3DDraw()
Prepare frame painter for 3D drawing
- Source:
(private) beforeRender3D()
Cleanup previous renderings before doing next one
- Description:
used together with SVG
- Source:
(private) browserIconClick()
handle click on browser icon
- Source:
build(obj, optopt) → {object}
Build three.js model for given geometry object
- Source:
Example
import { build } from 'https://root.cern/js/latest/modules/geom/TGeoPainter.mjs';
let obj3d = build(obj);
// this is three.js object and can be now inserted in the scene
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
obj |
Object | TGeo-related object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
opt |
Object |
<optional> |
options Properties
|
Returns:
Object3D with created model
- Type
- object
(private) buildCompositeVolume()
Function used to build hierarchy of elements of composite shapes
- Source:
(async) buildGUI(gui_element, gui_kind) → {Promise}
Build main GUI
Example
import { buildGUI } from 'https://root.cern/js/latest/modules/gui.mjs';
buildGUI('guiDiv');
Parameters:
Name | Type | Description |
---|---|---|
gui_element |
String | id of the |
gui_kind |
String | either 'online', 'nobrowser', 'draw' |
Returns:
with HierarchyPainter
instance
- Type
- Promise
(private) buildHist2dContour()
Build histogram contour lines
- Source:
(private) buildOverlapVolume()
Function used to build hierarchy of elements of overlap object
- Source:
(private) buildSurf3D()
Build 3d surface
- Description:
Make it independent from three.js to be able reuse it for 2D case
- Source:
(private) buildSvgCurve()
Build smooth SVG curve using Bezier
- Description:
Reuse code from https://stackoverflow.com/questions/62855310
- Source:
(private) canDrawHandle()
Returns true if handle can be potentially drawn
(private) canExpandHandle()
Check if draw handle for specified object can do expand
- Source:
(private) change3DCamera()
Change camera kind in frame painter
- Source:
(private) changeObjectMember()
Change object member in the painter
- Description:
Used when interactively change in the menu Special handling for color is provided
- Source:
(private) checkArrayPrototype()
Checks array kind
- Description:
return 0 when not array 1 - when arbitrary array 2 - when plain (1-dim) array with same-type content
- Source:
(private) checkDuplicates()
Check duplicates
- Source:
(private) chooseTimeFormat()
Tries to choose time format for provided time interval
- Source:
cleanup(dom)
Safely remove all drawings from specified element
- Source:
Example
import { cleanup } from 'https://root.cern/js/latest/modules/base/ObjectPainter.mjs';
cleanup('drawing');
cleanup(document.querySelector('#drawing'));
Parameters:
Name | Type | Description |
---|---|---|
dom |
string | object | id or DOM element |
(private) cleanupRender3D()
Cleanup created renderer object
- Source:
(private) cleanupShape()
Cleanup shape entity
- Source:
(private) clone() → {object}
Make deep clone of the object, including all sub-objects
Returns:
cloned object
- Type
- object
(private) closeCurrentWindow()
Tries to close current browser tab
- Description:
Many browsers do not allow simple window.close() call, therefore try several workarounds
- Source:
closeMenu(menunameopt)
Close previously created and shown JSROOT menu
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
menuname |
string |
<optional> |
optional menu name |
(private) compare_stacks() → {Number}
Compares two stacks.
- Source:
Returns:
0 if same, -1 when stack1 < stack2, +1 when stack1 > stack2
- Type
- Number
(private) compressSVG()
Compress SVG code, produced from drawing
- Description:
removes extra info or empty elements
- Source:
(async) connectWebWindow(arg) → {Promise}
Method used to initialize connection to web window.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg |
object | arguments Properties
|
Returns:
WebWindowHandle
instance
- Type
- Promise
(private) convert3DtoPadNDC()
Converts 3D coordinate to the pad NDC
- Source:
(private) convertColor()
Convert color string to unify node.js and browser
- Source:
convertDate()
Convert Date object into string used configured time zone
- Description:
Time zone stored in settings.TimeZone
- Source:
(private) countGeometryFaces(geom)
Returns number of faces for provided geometry
- Source:
Parameters:
Name | Type | Description |
---|---|---|
geom |
can be BufferGeometry, CsgGeometry or interim array of polygons |
(private) countNumShapes()
Returns number of shapes
- Description:
Used to count total shapes number in composites
- Source:
create(typename)
Create some ROOT classes
- Description:
Supported classes:
TObject
,TNamed
,TList
,TAxis
,TLine
,TText
,TLatex
,TPad
,TCanvas
- Source:
Example
import { create } from 'https://root.cern/js/latest/modules/core.mjs';
let obj = create('TNamed');
obj.fName = 'name';
obj.fTitle = 'title';
Parameters:
Name | Type | Description |
---|---|---|
typename |
string | ROOT class name |
(private) create3DLineMaterial()
Create material for 3D line
- Description:
Takes into account dashed properties
- Source:
(private) create3DScene() → {Promise}
Create all necessary components for 3D drawings in frame painter
- Source:
Returns:
when render3d !== -1
- Type
- Promise
(private) create8edgesBuffer()
Creates 8 edges geometry
- Source:
(private) createArb8Buffer()
Creates arb8 geometry
- Source:
(private) createComposite()
Creates geometry for composite shape
- Source:
(private) createCubeBuffer()
Creates cube geometry
- Source:
(private) createEltuBuffer()
Creates eltu geometry
- Source:
(private) createFlippedMesh(shape, material)
Create flipped mesh for the shape
- Description:
When transformation matrix includes one or several inversion of axis, one should inverse geometry object, otherwise three.js cannot correctly draw it
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape |
Object | TGeoShape object |
material |
Object | material |
(private) createFrustum()
Creates frustum
- Source:
(private) createGeoPainter()
Create geo painter
- Source:
(private) createGeometry(shape, limit)
Creates geometry model for the provided shape
- Description:
- if limit === 0 (or undefined) returns BufferGeometry
- if limit < 0 just returns estimated number of faces
- if limit > 0 return list of CsgPolygons (used only for composite shapes)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape |
Object | instance of TGeoShape object |
limit |
Number | defines return value, see details |
(private) createHalfSpace()
Creates half-space geometry for given shape
- Description:
Just big-enough triangle to make BSP calculations
- Source:
createHistogram(typename, nbinsx, nbinsyopt, nbinszopt) → {Object}
Create histogram object of specified type
Example
import { createHistogram } from 'https://root.cern/js/latest/modules/core.mjs';
let h1 = createHistogram('TH1I', 20);
h1.fName = 'Hist1';
h1.fTitle = 'Histogram title';
h1.fXaxis.fTitle = 'xaxis';
h1.fYaxis.fTitle = 'yaxis';
h1.fXaxis.fLabelSize = 0.02;
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
typename |
string | histogram typename like 'TH1I' or 'TH2F' |
|
nbinsx |
number | number of bins on X-axis |
|
nbinsy |
number |
<optional> |
number of bins on Y-axis (for 2D/3D histograms) |
nbinsz |
number |
<optional> |
number of bins on Z-axis (for 3D histograms) |
Returns:
created histogram object
- Type
- Object
(private) createHttpRequest()
Method to create http request, without promise can be used only in browser environment
(private) createHypeBuffer()
Creates hype geometry
- Source:
(private) createInspectorContent()
Create hierarchy for object inspector
- Source:
(private) createItem()
create hierarchy item for geo object
- Source:
(private) createLineSegments()
Create LineSegments mesh (or only geometry)
- Description:
If required, calculates lineDistance attribute for dashed geometries
- Source:
(private) createList()
create list entity for geo object
- Source:
(private) createMaterial()
Create node material
- Source:
(private) createMatrix()
Creates Matrix4 from TGeoMatrix
- Source:
(private) createMemberStreamer()
create member entry for streamer element
createMenu(evntopt, handleropt, menunameopt)
Create JSROOT menu
- Description:
See
JSRootMenu
class for detailed list of methods
- Source:
Example
import { createMenu } from 'https://root.cern/js/latest/modules/gui/menu.mjs';
let menu = await createMenu());
menu.add('First', () => console.log('Click first'));
let flag = true;
menu.addchk(flag, 'Checked', arg => console.log(`Now flag is ${arg}`));
menu.show();
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
evnt |
object |
<optional> |
event object like mouse context menu event |
handler |
object |
<optional> |
object with handling function, in this case one not need to bind function |
menuname |
string |
<optional> |
optional menu name |
(private) createNormal()
create geometry to make cut on specified axis
- Source:
(private) createOrbitControl()
Create OrbitControls for painter
- Source:
(private) createPairStreamer()
Create streamer info for pair object
(private) createParaBuffer()
Creates PARA geometry
- Source:
(private) createParaboloidBuffer()
Creates para geometry
- Source:
(private) createPolygonBuffer()
Creates polygon geometry
- Source:
(private) createProjectionMatrix()
Creates projection matrix for the camera
- Source:
(async, private) createRender3D(width, height, render3d, args) → {Promise}
Creates renderer for the 3D drawings
- Source:
Parameters:
Name | Type | Description |
---|---|---|
width |
value | rendering width |
height |
value | rendering height |
render3d |
value | render type, see |
args |
object | different arguments for creating 3D renderer |
Returns:
with renderer object
- Type
- Promise
(private) createRootColors()
Generates all root colors, used also in jstests to reset colors
- Source:
(private) createServerGeometry()
Create single shape from provided raw data from web viewer.
- Description:
If nsegm changed, shape will be recreated
- Source:
(private) createSphereBuffer()
Creates sphere geometry
- Source:
(private) createStreamerElement()
create element of the streamer
(private) createStreamerInfoContent()
Create hierarchy for streamer info object
- Source:
createTGraph(npoints, xptsopt, yptsopt)
Creates TGraph object
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
npoints |
number | number of points in TGraph |
|
xpts |
array |
<optional> |
array with X coordinates |
ypts |
array |
<optional> |
array with Y coordinates |
createTHStack()
Creates THStack object
- Description:
As arguments one could specify any number of histograms objects
- Source:
Example
import { createHistogram, createTHStack } from 'https://root.cern/js/latest/modules/core.mjs';
let nbinsx = 20;
let h1 = createHistogram('TH1F', nbinsx);
let h2 = createHistogram('TH1F', nbinsx);
let h3 = createHistogram('TH1F', nbinsx);
let stack = createTHStack(h1, h2, h3);
createTMultiGraph()
Creates TMultiGraph object
- Description:
As arguments one could specify any number of TGraph objects
- Source:
Example
import { createTGraph, createTMultiGraph } from 'https://root.cern/js/latest/modules/core.mjs';
let gr1 = createTGraph(100);
let gr2 = createTGraph(100);
let gr3 = createTGraph(100);
let mgr = createTMultiGraph(gr1, gr2, gr3);
createTPolyLine(npoints, use_int32opt)
Creates TPolyLine object
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
npoints |
number | number of points |
|
use_int32 |
boolean |
<optional> |
use Int32Array type for points, default is Float32Array |
(private) createTessellatedBuffer()
Creates tessellated geometry
- Source:
(private) createTextGeometry()
Create plain text geometry
- Source:
(private) createTorusBuffer()
Creates torus geometry
- Source:
(private) createTrapezoidBuffer()
Creates trapezoid geometry
- Source:
(private) createTreePlayer()
Create painter to perform tree drawing on server side
- Source:
(private) createTubeBuffer()
Creates tube geometry
- Source:
(private) createWebObjectOptions()
Fill TWebObjectOptions for painter
- Source:
(private) createXtruBuffer()
Creates xtru geometry
- Source:
decodeUrl(urlopt) → {Object}
decodes URL options after '?' mark
Example
import { decodeUrl } from 'https://root.cern/js/latest/modules/core.mjs';
let d = decodeUrl('any?opt1&op2=3');
console.log(`Has opt1 ${d.has('opt1')}`); // true
console.log(`Get opt1 ${d.get('opt1')}`); // ''
console.log(`Get opt2 ${d.get('opt2')}`); // '3'
console.log(`Get opt3 ${d.get('opt3','-')}`); // '-'
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string |
<optional> |
URL string with options, document.URL will be used when not specified |
Returns:
with .has(opt)
and .get(opt,dflt)
methods
- Type
- Object
(private) decodeWebCanvasColors()
Decode list of ROOT colors coded by TWebCanvas
- Source:
(private) defineMemberTypeName()
return type name of given member in the class
(private) detectBranchMemberClass()
try to define classname for the branch member, scanning list of branches
(private) detectPdfFont()
Try to detect and create font handler for SVG text node
- Source:
(private) detectRightButton()
Detect mouse right button
- Source:
(private) directDrawTFrame()
direct draw of TFrame object,
- Description:
pad or canvas should already exist
- Source:
(private) disposeThreejsObject()
Method cleanup three.js object as much as possible.
- Description:
Simplify JS engine to remove it from memory
- Source:
(async) draw(dom, obj, opt) → {Promise}
Draw object in specified HTML element with given draw options.
- Description:
An extensive list of support draw options can be found on examples page
- Source:
Example
import { openFile } from 'https://root.cern/js/latest/modules/io.mjs';
import { draw } from 'https://root.cern/js/latest/modules/draw.mjs';
let file = await openFile('https://root.cern/js/files/hsimple.root');
let obj = await file.readObject('hpxpy;1');
await draw('drawing', obj, 'colz;logx;gridx;gridy');
Parameters:
Name | Type | Description |
---|---|---|
dom |
string | object | id of div element to draw or directly DOMElement |
obj |
object | object to draw, object type should be registered before with |
opt |
string | draw options separated by space, comma or semicolon |
Returns:
with painter object
- Type
- Promise
(private) drawAxis3D()
Direct draw function for TAxis3D
- Source:
(private) drawBinsContour3D()
Draw TH2 as 3D contour plot
- Source:
(private) drawBinsError3D()
Draw TH2 histogram in error mode
- Source:
(private) drawBinsLego()
Draw histograms in 3D mode
- Source:
(private) drawBinsSurf3D()
Draw TH2 histograms in surf mode
- Source:
(private) drawBox()
draw RBox object
- Source:
(async, private) drawDummy3DGeom()
Draw dummy geometry
- Source:
(private) drawEllipse()
Draw TEllipse
- Source:
(private) drawHistDisplayItem()
draw RHistDisplayItem object
- Source:
(async, private) drawInspector()
Display inspector
- Source:
(private) drawJSImage()
Draw JS image
- Source:
(private) drawLeafPlayer()
function used with THttpServer when tree is not yet loaded
- Source:
(private) drawLine()
draw RLine object
- Source:
(async, private) drawList()
draw list content
- Description:
used to draw all items from TList or TObjArray inserted into the TCanvas list of primitives
- Source:
(private) drawMarker()
Draw TMarker
- Source:
(private) drawMarker()
draw RMarker object
- Source:
(private) drawPie()
Draw TPie
- Source:
(async, private) drawPolyLine3D()
Direct draw function for TPolyLine3D object
- Description:
Takes into account dashed properties
- Source:
(private) drawPolyMarker()
Draw TPolyMarker
- Source:
(async, private) drawPolyMarker3D()
direct draw function for TPolyMarker3D object
- Source:
(async, private) drawPolyMarker3D()
direct draw function for TPolyMarker3D object (optionally with geo painter)
- Source:
(private) drawRAxis()
draw RAxis object
- Source:
(private) drawRFont()
draw RFont object
- Source:
(private) drawRFrame()
draw RFrame object
- Source:
(private) drawRFrameTitle()
Function used for direct draw of RFrameTitle
- Source:
(private) drawRPadSnapshot()
draw RPadSnapshot object
- Source:
(private) drawRawText()
Generic text drawing
- Source:
(async, private) drawRooPlot()
Draw TRooPlot
- Source:
(async, private) drawStreamerInfo()
Display streamer info
- Source:
(async, private) drawTFrame()
draw TFrame object
- Source:
(private) drawTH2PolyLego()
Draw TH2Poly histogram as lego
- Source:
(async, private) drawTPadSnapshot()
draw TPad snapshot from TWebCanvas
- Source:
(async, private) drawText()
Draw TText
- Source:
(private) drawText()
draw RText object
- Source:
(async, private) drawTree()
function called from draw()
- Description:
just envelope for real TTree::Draw method which do the main job Can be also used for the branch and leaf object
- Source:
(async, private) drawTreeDrawResult()
Draw result of tree drawing
- Source:
(private) drawTreePlayer()
function used with THttpServer to assign player for the TTree object
- Source:
(private) drawTreePlayerKey()
function used with THttpServer when tree is not yet loaded
- Source:
(private) drawXYZ()
Draw axes in 3D mode
- Source:
drawingJSON(dom) → {string}
Save object, drawn in specified element, as JSON.
- Description:
Normally it is TCanvas object with list of primitives
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dom |
string | object | id of top div element or directly DOMElement |
Returns:
produced JSON string
- Type
- string
(async, private) ensureRCanvas(painter, frame_kind) → {Promise}
Ensure RCanvas and RFrame for the painter object
- Description:
Assigns DOM, creates and draw RCanvas and RFrame if necessary, add painter to pad list of painters
- Source:
Parameters:
Name | Type | Description |
---|---|---|
painter |
Object | painter object to process |
frame_kind |
string | boolean | false for no frame or '3d' for special 3D mode |
Returns:
for ready
- Type
- Promise
(async) ensureTCanvas(painter, frame_kind)
Ensure TCanvas and TFrame for the painter object
- Description:
Assign dom, creates TCanvas if necessary, add to list of pad painters
- Source:
Parameters:
Name | Type | Description |
---|---|---|
painter |
Object | painter object to process |
frame_kind |
string | boolean | false for no frame or '3d' for special 3D mode |
(private) expandGeoObject()
Expand geo object
- Source:
(private) extendRootColors()
Add new colors from object array
- Source:
(private) findBrachStreamerElement()
return TStreamerElement associated with the branch - if any
- Description:
unfortunately, branch.fID is not number of element in streamer info
- Source:
(private) findBranch(name) → {Object}
Search branch with specified name
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of the branch |
Returns:
found branch
- Type
- Object
(private) findBranchComplex(name) → {Object}
Special branch search
- Description:
Name can include extra part, which will be returned in the result
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of the branch |
Returns:
with 'branch' and 'rest' members
- Type
- Object
(private) findColor()
Search for specified color in the list of colors
- Source:
Returns:
Color index or -1 if fails
(private) findFunction()
Find function with given name
(private) findItemWithPainter()
find item with 3d painter
- Source:
(private) floatToString(value, fmtopt, ret_fmtopt) → {string|Array}
Converts numeric value to string according to specified format.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
number | value to convert |
||
fmt |
string |
<optional> |
'6.4g'
|
format can be like 5.4g or 4.2e or 6.4f |
ret_fmt |
boolean |
<optional> |
when true returns array with value and actual format like ['0.1','6.4f'] |
Returns:
- converted value or array with value and actual format
- Type
- string | Array
(private) folderHierarchy()
Create hierarchy elements for TFolder object
- Source:
(private) geoCfg()
Returns or set geometry config values
- Description:
Supported 'GradPerSegm' and 'CompressComp'
- Source:
(private) geoWarn()
method used to avoid duplication of warnings
- Source:
(private) geomBoundingBox()
Returns geometry bounding box
- Source:
(private) get3DBox()
Function to extract 3DBox for poly marker and line
- Source:
(private) getAbsPosInCanvas()
Calculate absolute position of provided element in canvas
- Source:
(private) getActivePad()
Returns current active pad
- Description:
Should be used only for keyboard handling
- Source:
(private) getArrayKind()
Analyze and returns arrays kind
Returns:
0 if TString (or equivalent), positive value - some basic type, -1 - any other kind
(private) getBinFileContent()
Returns image file content as it should be stored on the disc
- Description:
Replaces all kind of base64 coding
- Source:
(private) getBoundingBox()
extract code of Box3.expandByObject
- Description:
Major difference - do not traverse hierarchy, support InstancedMesh
- Source:
(private) getBoxDecorations()
Box decorations
- Source:
(private) getBranchObjectClass()
return class name of the object, stored in the branch
(private) getBrowserIcon()
Get icon for the browser
- Source:
(private) getCameraDefaultPosition()
Returns camera default position
- Source:
(private) getColor() → {String}
Return ROOT color by index
- Description:
Color numbering corresponds typical ROOT colors
- Source:
Returns:
with RGB color code or existing color name like 'cyan'
- Type
- String
(private) getColorExec()
Produce exec string for WebCanvas to set color value
- Description:
Color can be id or string, but should belong to list of known colors For higher color numbers TColor::GetColor(r,g,b) will be invoked to ensure color is exists
- Source:
(private) getColorId()
Returns color id for the color
- Source:
(private) getColorPalette()
Create color palette
- Source:
(private) getContentType()
Returns type of file content
- Source:
(private) getCustomFont()
Return handle with custom font
- Source:
(private) getDocument()
Method returns current document in use
(private) getDrawHandle()
return draw handle for specified item kind
- Description:
kind could be ROOT.TH1I for ROOT classes or just kind string like 'Command' or 'Text' selector can be used to search for draw handle with specified option (string) or just sequence id
- Source:
(private) getDrawSettings()
Provide draw settings for specified class or kind
(private) getEarthProjectionFunc()
Returns coordinates transformation func
- Source:
(private) getElementCanvPainter(dom)
Returns canvas painter (if any) for specified HTML element
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dom |
string | object | id or DOM element |
(private) getElementMainPainter(dom)
Returns main painter (if any) for specified HTML element - typically histogram painter
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dom |
string | object | id or DOM element |
(private) getElementRect(elem, kindopt)
Returns visible rect of element
- Description:
kind = 'bbox' use getBBox, works only with SVG kind = 'full' - full size of element, using getBoundingClientRect function kind = 'nopadding' - excludes padding area With node.js can use 'width' and 'height' attributes when provided in element
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elem |
object | d3.select object with element |
|
kind |
string |
<optional> |
which size method is used |
(private) getGrayColors()
Return list of grey colors for the original array
- Source:
(private) getHImpl()
Returns real histogram impl
- Source:
(private) getHPainter()
Returns current hierarchy painter object
- Source:
(private) getHelveticaFont()
Create three.js Helvetica Regular Font instance
- Source:
(private) getHistPainter3DCfg() → {Object}
Provides 3D rendering configuration from histogram painter
- Source:
Returns:
with scene, renderer and other attributes
- Type
- Object
(private) getIntersectStack()
Return stack for the item from list of intersection
- Source:
(private) getMaterialArgs()
Create three.js Color instance, handles optional opacity
- Source:
(private) getMethods()
Returns methods for given typename
(private) getNodeKind()
Analyze TGeo node kind
- Description:
0 - TGeoNode 1 - TEveGeoNode -1 - unsupported
- Source:
Returns:
detected node kind
(private) getNodeMatrix()
Creates transformation matrix for TGeoNode
- Description:
created after node visibility flag is checked and volume cut is performed
- Source:
(private) getObjectName()
Returns geo object name
- Description:
Can appends some special suffixes
- Source:
(private) getPairStreamer()
Function creates streamer for std::pair object
(private) getPromise()
Provide promise in any case
(private) getRGBfromTColor()
Produces rgb code for TColor object
- Source:
(private) getRender3DKind(render3dopt, is_batchopt) → {value}
Define rendering kind which will be used for rendering of 3D elements
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
render3d |
value |
<optional> |
preconfigured value, will be used if applicable |
is_batch |
value |
<optional> |
is batch mode is configured |
Returns:
- rendering kind, see constants.Render3D
- Type
- value
(private) getRootColors()
Get list of colors
- Source:
(private) getShapeIcon()
provide icon name for the shape
- Source:
(private) getSizeStr()
Return size as string with suffix like MB or KB
- Source:
(private) getSvgLineStyle()
Get svg string for specified line style
- Source:
getTDatime()
Convert ROOT TDatime object into Date
- Description:
Always use UTC to avoid any variation between timezones
- Source:
(private) getTF1Value()
Provide TF1 value
- Description:
First try evaluate, if not possible - check saved buffer
- Source:
(private) getTimeGMT()
Return true when GMT option configured in time format
- Source:
(private) getTimeOffset()
Return time offset value for given TAxis object
- Source:
(private) getTreeBranch() → {Object}
Get branch with specified id
Returns:
branch
- Type
- Object
(private) getTypeId()
Returns type id by its name
(private) get_touch_pointers()
Return pointers on touch event
- Source:
graph2DTooltip()
Function handles tooltips in the mesh
- Source:
(private) hasMenu()
Returns true if menu or modal dialog present
- Source:
(private) highlightBin3D()
Highlight bin in frame painter 3D drawing
- Source:
(async) httpRequest(url, kind, post_dataopt) → {Promise}
Submit asynchronous http request
- Description:
Following requests kind can be specified:
- 'bin' - abstract binary data, result as string
- 'buf' - abstract binary data, result as ArrayBuffer (default)
- 'text' - returns req.responseText
- 'object' - returns parse(req.responseText)
- 'multi' - returns correctly parsed multi.json request
- 'xml' - returns req.responseXML
- 'head' - returns request itself, uses 'HEAD' request method
- 'post' - creates post request, submits req.send(post_data)
- 'postbuf' - creates post request, expects binary data as response
- Source:
Example
import { httpRequest } from 'https://root.cern/js/latest/modules/core.mjs';
httpRequest('https://root.cern/js/files/thstack.json.gz', 'object')
.then(obj => console.log(`Get object of type ${obj._typename}`))
.catch(err => console.error(err.message));
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string | URL for the request |
|
kind |
string | kind of requested data |
|
post_data |
string |
<optional> |
data submitted with post kind of request |
Returns:
Promise for requested data, result type depends from the kind
- Type
- Promise
(async, private) importThreeJs()
Import proper three.js version
- Description:
in node.js only r162 supports WebGL1 which can be emulated with "gl" package. Therefore only this version can be used for working in node.js
- Source:
(async, private) injectCode() → {Promise}
Inject javascript code
Returns:
when code is injected
- Type
- Promise
(private) injectGeoStyle()
Create geo-related css entries
- Source:
(private) injectStyle(code)
Inject style
- Source:
Parameters:
Name | Type | Description |
---|---|---|
code |
String | css string |
(private) isArrayProto() → {Number}
Check if prototype string match to array (typed on untyped)
Returns:
0 - not array, 1 - regular array, 2 - typed array
- Type
- Number
isBatchMode()
Indicates if running in batch mode
(private) isDefaultStatPosition()
Returns true if stat box on default place and can be adjusted
- Source:
(private) isFunc()
Check if argument is a Function
isNodeJs()
Indicates if running inside Node.js
(private) isObject()
Check if argument is a not-null Object
(private) isPlainText()
Check if plain text
- Source:
(private) isPromise()
Check if object is a Promise
(private) isRootCollection(lst, typenameopt)
Returns true if object represents basic ROOT collections
- Description:
Checks if type is TList or TObjArray or TClonesArray or TMap or THashList
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
lst |
object | object to check |
|
typename |
string |
<optional> |
or just typename to check |
(private) isSameStack()
Checks if two stack arrays are identical
- Source:
(private) isStr()
Check if argument is a String
(private) is_dragging()
Check if dragging performed currently
- Source:
(private) keysHierarchy()
Create hierarchy of TKey lists in file or sub-directory
- Source:
(private) listHierarchy()
Create hierarchy elements for TList object
- Source:
(async, private) loadFontFile() → {Promise}
Read font file from some pre-configured locations
- Source:
Returns:
with base64 code of the font
- Type
- Promise
(async, private) loadMathjax()
Load MathJax functionality,
- Description:
one need not only to load script but wait for initialization
- Source:
(async) loadModules(arg) → {Promise}
Load ES6 modules
Parameters:
Name | Type | Description |
---|---|---|
arg |
String | single URL or array of URLs |
Returns:
- Type
- Promise
(async, private) loadOpenui5() → {Promise}
load openui5
- Source:
Returns:
for loading ready
- Type
- Promise
(async) loadScript(url) → {Promise}
Load script or CSS file into the browser
Parameters:
Name | Type | Description |
---|---|---|
url |
String | script or css file URL (or array, in this case they all loaded sequentially) |
Returns:
- Type
- Promise
(private) makeEveGeometry()
Create single shape from EVE7 render date
- Source:
(async) makeImage(args) → {Promise}
Create SVG/PNG/JPEG image for provided object.
- Description:
Function especially useful in Node.js environment to generate images for supported ROOT classes, but also can be used from web browser
- Source:
Example
// how makeImage can be used in node.js
import { openFile, makeImage } from 'jsroot';
let file = await openFile('https://root.cern/js/files/hsimple.root');
let object = await file.readObject('hpxpy;1');
let png64 = await makeImage({ format: 'png', object, option: 'colz', width: 1200, height: 800 });
let pngbuf = await makeImage({ format: 'png', as_buffer: true, object, option: 'colz', width: 1200, height: 800 });
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | function settings Properties
|
Returns:
with image code - svg as is, png/jpeg as base64 string or buffer (if as_buffer) specified
- Type
- Promise
(private) makeMethodsList()
create fast list to assign all methods to the object
(async, private) makePDF() → {Promise}
Create pdf for existing SVG element
- Source:
Returns:
with produced PDF file as url string
- Type
- Promise
(async) makeSVG(args) → {Promise}
Create SVG image for provided object.
- Description:
Function especially useful in Node.js environment to generate images for supported ROOT classes
- Source:
Example
// how makeSVG can be used in node.js
import { openFile, makeSVG } from 'jsroot';
let file = await openFile('https://root.cern/js/files/hsimple.root');
let object = await file.readObject('hpxpy;1');
let svg = await makeSVG({ object, option: 'lego2,pal50', width: 1200, height: 800 });
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | function settings Properties
|
Returns:
with svg code
- Type
- Promise
(private) makeTranslate()
Return translate string for transform attribute of some svg element
- Source:
Returns:
string or null if x and y are zeros
(private) makeViewerGeometry()
Create single shape from geometry viewer render date
- Source:
(private) markAsStreamerInfo()
tag item in hierarchy painter as streamer info
- Description:
this function used on THttpServer to mark streamer infos list as fictional TStreamerInfoList class, which has special draw function
- Source:
(private) numGeometryFaces(geom)
Returns number of faces for provided geometry
- Source:
Parameters:
Name | Type | Description |
---|---|---|
geom |
Object | can be BufferGeometry, CsgGeometry or interim array of polygons |
(private) numGeometryVertices(geom)
Returns number of faces for provided geometry
- Source:
Parameters:
Name | Type | Description |
---|---|---|
geom |
Object | can be BufferGeometry, CsgGeometry or interim array of polygons |
(private) objectHierarchy()
Create hierarchy for arbitrary object
- Source:
(private) onlineHierarchy()
central function for expand of all online items
- Source:
openFile(arg, optsopt) → {object}
Open ROOT file for reading
- Description:
Generic method to open ROOT file for reading Following kind of arguments can be provided:
- string with file URL (see example). In node.js environment local file like 'file://hsimple.root' can be specified
- File instance which let read local files from browser
- ArrayBuffer instance with complete file content
FileProxy
let access arbitrary files via tiny proxy API
- Source:
Example
import { openFile } from 'https://root.cern/js/latest/modules/io.mjs';
let f = await openFile('https://root.cern/js/files/hsimple.root');
console.log(`Open file ${f.getFileName()}`);
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg |
string | object | argument for file open like url, see details |
||||||||||||||||
opts |
object |
<optional> |
extra arguments Properties
|
Returns:
- Promise with
TFile
instance when file is opened
- Type
- object
parse(json) → {object}
Should be used to parse JSON string produced with TBufferJSON class
Parameters:
Name | Type | Description |
---|---|---|
json |
object | string | object where references will be replaced |
Returns:
parsed object
- Type
- object
(private) parseAsArray()
Parse string value as array.
- Description:
It could be just simple string: 'value' or array with or without string quotes: [element], ['elem1',elem2]
- Source:
(private) parseLatex()
translate TLatex and draw inside provided g element
- Description:
use
together with normal elements
- Source:
parseMulti(json) → {Array}
Parse response from multi.json request
- Description:
Method should be used to parse JSON code, produced by multi.json request of THttpServer
- Source:
Parameters:
Name | Type | Description |
---|---|---|
json |
string | string to parse |
Returns:
array of parsed elements
- Type
- Array
(private) postponePromise()
Postpone func execution and return result in promise
(private) produceLatex()
translate TLatex and draw inside provided g element
- Description:
use
together with normal elements
- Source:
(async, private) produceMathjax()
Produce text with MathJax
- Source:
(private) produceNormal()
Create normal to plane, defined with three points
- Source:
(private) producePlainText()
Just add plain text to the SVG text elements
- Source:
produceRenderOrder(toplevel, origin, method)
Set rendering order for created hierarchy
- Description:
depending from provided method sort differently objects
- Source:
Parameters:
Name | Type | Description |
---|---|---|
toplevel |
top element |
|
origin |
camera position used to provide sorting |
|
method |
name of sorting method like 'pnt', 'ray', 'size', 'dflt' |
(private) produceTAxisLogScale()
Create log scale for axis bins
- Source:
(private) proivdeEvalPar()
Assign evalPar
function for TF1 object
- Source:
(private) projectGeometry()
Try to create projected geometry
- Source:
(private) provideMenu()
provide menu for geo object
- Source:
(private) provideObjectInfo(obj)
Provides info about geo object, used for tooltip info
- Source:
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | any kind of TGeo-related object like shape or node or volume |
(private) provideVisStyle()
provide css style for geo object
- Source:
(private) readLocalStorage()
Read object from storage with specified name
- Source:
(private) readMapElement()
Function used in streamer to read std::map object
(private) readSettings(only_check, nameopt)
Read JSROOT settings from specified cookie parameter
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
only_check |
Boolean |
false
|
when true just checks if settings were stored before with provided name |
|
name |
String |
<optional> |
settings
|
storage name, 'settings' by default |
(private) readStyle(only_checkopt, nameopt)
Read JSROOT gStyle object from local storage
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
only_check |
Boolean |
<optional> |
false
|
when true just checks if settings were stored before with provided name |
name |
String |
<optional> |
style
|
storage name, 'style' by default |
(private) readStyleFromURL()
Read style and settings from URL
(private) readVectorElement()
Function to read vector element in the streamer
reconstructObject(class_name, obj_rawdata, sinfo_rawdata) → {object}
Reconstruct ROOT object from binary buffer
- Description:
Method can be used to reconstruct ROOT objects from binary buffer which can be requested from running
THttpServer
, using root.bin request To decode data, one has to request streamer infos data after object data as it shown in example.Method provided for convenience only to see how binary IO works. It is strongly recommended to use root.json request to get data directly in JSON format
- Source:
Example
import { httpRequest } from 'jsroot/core';
import { reconstructObject } from 'jsroot/io';
const obj_data = await httpRequest('http://localhost:8080/Files/job1.root/hpx/root.bin', 'buf');
const si_data = await httpRequest('http://localhost:8080/StreamerInfo/root.bin', 'buf');
const histo = await reconstructObject('TH1F', obj_data, si_data);
console.log(`Get histogram with title = ${histo.fTitle}`);
// request same data via root.json request
httpRequest('http://localhost:8080/Files/job1.root/hpx/root.json', 'object')
.then(histo => console.log(`Get histogram with title = ${histo.fTitle}`));
Parameters:
Name | Type | Description |
---|---|---|
class_name |
string | Class name of the object |
obj_rawdata |
binary | data of object root.bin request |
sinfo_rawdata |
binary | data of streamer info root.bin request |
Returns:
- created JavaScript object
- Type
- object
(async) redraw(dom, obj, opt) → {Promise}
Redraw object in specified HTML element with given draw options.
- Description:
If drawing was not done before, it will be performed with
draw
. Otherwise drawing content will be updated
- Source:
Example
import { openFile } from 'https://root.cern/js/latest/modules/io.mjs';
import { draw, redraw } from 'https://root.cern/js/latest/modules/draw.mjs';
let file = await openFile('https://root.cern/js/files/hsimple.root');
let obj = await file.readObject('hpxpy;1');
await draw('drawing', obj, 'colz');
let cnt = 0;
setInterval(() => {
obj.fTitle = `Next iteration ${cnt++}`;
redraw('drawing', obj, 'colz');
}, 1000);
Parameters:
Name | Type | Description |
---|---|---|
dom |
string | object | id of div element to draw or directly DOMElement |
obj |
object | object to draw, object type should be registered before with |
opt |
string | draw options |
Returns:
with painter object
- Type
- Promise
(protected) registerForResize(handle, delayopt)
Register handle to react on window resize
- Description:
function used to react on browser window resize event While many resize events could come in short time, resize will be handled with delay after last resize event
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
handle |
object | string | can be function or object with checkResize function or dom where painting was done |
|
delay |
number |
<optional> |
one could specify delay after which resize event will be handled |
(private) registerMethods()
Add methods for specified type.
(private) remapSymbolTtfCode()
Return code for symbols from symbols.ttf
- Description:
Used in PDF generation
- Source:
(private) remove3DMeshes()
Remove 3D meshed for specified painter
- Source:
(private) render3D(tmout)
call 3D rendering of the frame
- Description:
Timeout used to avoid multiple rendering of the picture when several 3D drawings superimposed with each other. If tmout <= 0, rendering performed immediately If tmout === -1111, immediate rendering with SVG renderer is performed
- Source:
Parameters:
Name | Type | Description |
---|---|---|
tmout |
number | specifies delay, after which actual rendering will be invoked |
(private) repairMathJaxSvgSize()
Workaround to fix size attributes in MathJax SVG
- Source:
(private) replaceSymbols()
Replace codes from symbols.ttf into normal font - when symbols.ttf cannot be used
- Source:
(private) replaceSymbolsInTextNode()
Reformat text node if it includes greek or special symbols
- Description:
Used in PDF generation where greek symbols are not available
- Source:
resize(dom, arg)
Check resize of drawn element
- Description:
As first argument dom one should use same argument as for the drawing As second argument, one could specify 'true' value to force redrawing of the element even after minimal resize Or one just supply object with exact sizes like { width:300, height:200, force:true };
- Source:
Example
import { resize } from 'https://root.cern/js/latest/modules/base/ObjectPainter.mjs';
resize('drawing', { width: 500, height: 200 });
resize(document.querySelector('#drawing'), true);
Parameters:
Name | Type | Description |
---|---|---|
dom |
string | object | id or DOM element |
arg |
boolean | object | options on how to resize |
(private) resize3D()
Check is 3D drawing need to be resized
- Source:
(async, private) saveFile()
Function store content as file with filename
- Source:
(private) saveLocalStorage()
Save object in local storage
- Source:
(private) saveSettings(expiresopt, nameopt)
Save JSROOT settings in local storage
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
expires |
Number |
<optional> |
365
|
delete settings when negative |
name |
String |
<optional> |
settings
|
storage name, 'settings' by default |
(private) saveStyle(expiresopt, nameopt)
Save JSROOT gStyle object in local storage
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
expires |
Number |
<optional> |
365
|
delete style when negative |
name |
String |
<optional> |
style
|
storage name, 'style' by default |
(private) selectActivePad(args)
Set active pad painter
- Description:
Normally be used to handle key press events, which are global in the web browser
- Source:
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | functions arguments Properties
|
(private) selectgStyle()
Select predefined style
- Source:
(private) set3DOptions()
Set options used for 3D drawings
- Source:
(private) setBatchMode()
Set batch mode
(private) setCameraPosition()
Set default camera position
- Source:
setDefaultDrawOpt()
Set default draw option for provided class
Example
import { setDefaultDrawOpt } from 'https://root.cern/js/latest/modules/draw.mjs';
setDefaultDrawOpt('TH1', 'text');
setDefaultDrawOpt('TH2', 'col');
(private) setGeoBit()
Set fGeoAtt bit
- Source:
(private) setHPainter()
Set hierarchy painter object
- Source:
setHistogramTitle()
Set histogram title
- Description:
Title may include axes titles, provided with ';' symbol like "Title;x;y;z"
- Source:
(private) setInvisibleAll()
Implementation of TGeoVolume::InvisibleAll
- Source:
(private) setPainterTooltipEnabled()
Configure tooltip enable flag for painter
- Source:
(private) setSaveFile()
Function store content as file with filename
- Source:
(private) setStoragePrefix()
Set custom prefix for the local storage
- Source:
(private) showPainterMenu()
Fill and show context menu for painter object
- Source:
(private) showProgress(msg, tmoutopt, click_handleopt)
Display progress message in the left bottom corner.
- Description:
Previous message will be overwritten if no argument specified, any shown messages will be removed
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
msg |
string | message to display |
|
tmout |
number |
<optional> |
optional timeout in milliseconds, after message will disappear |
click_handle |
function |
<optional> |
optional handle to process click events |
(async, private) svgToImage(svg, image_formatopt, argsopt) → {Promise}
Create image based on SVG
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
svg |
string | svg code of the image |
|||||||||
image_format |
string |
<optional> |
image format like 'png', 'jpeg' or 'webp' |
||||||||
args |
Objects |
<optional> |
optional arguments Properties
|
Returns:
with produced image in base64 form or as Buffer (or canvas when no image_format specified)
- Type
- Promise
(private) taskHierarchy()
Create hierarchy elements for TTask object
- Description:
function can be used for different derived classes we show not only child tasks, but all complex data members
- Source:
(private) testAxisVisibility()
Text 3d axis visibility
- Source:
(private) testGeoBit()
Test fGeoAtt bits
- Source:
(private) toAlfa()
Convert alfa value from rgba to string
- Source:
(private) toColor()
Convert r,g,b,a values to string
- Source:
(private) toDec()
Covert value between 0 and 1 into decimal string using scale factor, used for colors coding
- Source:
toJSON(obj, spacingopt) → {string}
Method converts JavaScript object into ROOT-like JSON
- Description:
When performed properly, JSON can be used in TBufferJSON::fromJSON() method to read data back with C++ Or one can again parse json with
parse
function
- Source:
Example
import { openFile, draw, toJSON } from 'https://root.cern/js/latest/modules/main.mjs';
let file = await openFile('https://root.cern/js/files/hsimple.root');
let obj = await file.readObject('hpxpy;1');
obj.fTitle = 'New histogram title';
let json = toJSON(obj);
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
object | JavaScript object to convert |
|
spacing |
number |
<optional> |
optional line spacing in JSON |
Returns:
produced JSON code
- Type
- string
(private) toggleGeoBit()
Toggle fGeoAttBit
- Source:
(private) translateLaTeX()
Simple replacement of latex letters
- Source:
(private) translateMath()
Function translates ROOT TLatex into MathJax format
- Source:
(async) treeDraw(args) → {Promise}
implementation of TTree::Draw
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | string | different setting or simply draw expression Properties
|
Returns:
with produced object
- Type
- Promise
(async, private) treeDrawProgress()
Handle callback function with progress of tree draw
- Source:
(private) treeHierarchy()
Create hierarchy of TTree object
(private) treeIOTest()
Performs generic I/O test for all branches in the TTree
(async) treeProcess(tree, selector, argsopt) → {Promise}
Process selector for the tree
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tree |
object | instance of TTree class |
|||||||||||||
selector |
object | instance of |
|||||||||||||
args |
object |
<optional> |
different arguments Properties
|
Returns:
with TSelector instance
- Type
- Promise
(private) tryOpenOpenUI()
Tries to open ui5
- Source:
(async, private) typesetMathjax()
Just typeset HTML node with MathJax
- Source:
(private) unzoomHistogramYRange()
Unzoom preselected range for main histogram painter
- Description:
Used with TGraph where Y zooming selected with fMinimum/fMaximum but histogram axis range can be wider. Or for normal histogram drawing when preselected range smaller than histogram range
- Source:
(private) updateBrowserIcons()
update icons
- Source: