new ObjectPainter(dom, obj, optopt)
Painter class for ROOT objects
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dom |
object | string | dom element or identifier |
|
obj |
object | object to draw |
|
opt |
string |
<optional> |
object draw options |
Methods
(protected) addColor() → {number}
Add color to list of colors
- Source:
Returned color index can be used as color number in all other draw functions
Returns:
new color index
- Type
- number
(protected) addToPadPrimitives(pad_nameopt)
Add painter to pad list of painters
- Source:
Normally one should use ensureTCanvas
to add painter to pad list of primitives
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pad_name |
string |
<optional> |
optional pad name where painter should be add |
(protected) assignObject()
Assign object to the painter
- Source:
(protected) axisToSvg(axis, value, ndc, noroundopt) → {number}
Converts x or y coordinate into pad SVG coordinates.
- Source:
Only can be used for painting in the pad, means CreateG() should be called without arguments
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
axis |
string | name like 'x' or 'y' |
|
value |
number | axis value to convert. |
|
ndc |
boolean | is value in NDC coordinates |
|
noround |
boolean |
<optional> |
skip rounding |
Returns:
value of requested coordiantes
- Type
- number
(protected) cleanup()
Generic method to cleanup painter.
- Source:
Remove object drawing and (in case of main painter) also main HTML components
configureUserClickHandler(handler)
Configure user-defined click handler
- Source:
Function will be called every time when frame click was perfromed As argument, tooltip object with selected bins will be provided If handler function returns true, default handling of click will be disabled
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | function called when mouse click is done |
configureUserContextMenu(fillmenu_func)
Configure user-defined context menu for the object
- Source:
fillmenu_func will be called when context menu is actiavted Arguments fillmenu_func are (menu,kind) First is menu object, second is object subelement like axis 'x' or 'y' Function should return promise with menu when items are filled
Parameters:
Name | Type | Description |
---|---|---|
fillmenu_func |
function | function to fill custom context menu for oabject |
configureUserDblclickHandler(handler)
Configure user-defined dblclick handler
- Source:
Function will be called every time when double click was called As argument, tooltip object with selected bins will be provided If handler function returns true, default handling of dblclick (unzoom) will be disabled
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | function called when mouse double click is done |
configureUserTooltipHandler(handler, tmoutopt)
Configure user-defined tooltip handler
- Source:
Hook for the users to get tooltip information when mouse cursor moves over frame area Hanlder function will be called every time when new data is selected when mouse leave frame area, handler(null) will be called
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
handler |
function | function called when tooltip is produced |
||
tmout |
number |
<optional> |
100
|
delay in ms before tooltip delivered |
(protected) createAttFill(args)
Creates fill attributes object.
- Source:
Method dedicated to create fill attributes, bound to canvas SVG
otherwise newly created patters will not be usable in the canvas
See TAttFillHandler
for more info.
Instance assigned as this.fillatt data member, recognized by GED editors
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | for special cases one can specify TAttFill as args or number of parameters Properties
|
Returns:
created handle
(protected) createAttLine(args)
Creates line attributes object.
- Source:
Can be used to produce lines in painter.
See TAttLineHandler
for more info.
Instance assigned as this.lineatt data member, recognized by GED editor
Parameters:
Name | Type | Description |
---|---|---|
args |
object | either TAttLine or see constructor arguments of |
(protected) createAttMarker(args) → {object}
Creates marker attributes object
- Source:
Can be used to produce markers in painter.
See TAttMarkerHandler
for more info.
Instance assigned as this.markeratt data member, recognized by GED editor
Parameters:
Name | Type | Description |
---|---|---|
args |
object | either TAttMarker or see arguments of |
Returns:
created handler
- Type
- object
(protected) createG(frame_layeropt)
(re)creates svg:g element for object drawings
- Source:
either one attach svg:g to pad primitives (default) or svg:g element created in specified frame layer ('main_layer' will be used when true specified)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
frame_layer |
boolean | string |
<optional> |
when specified, |
(protected) deleteAttr()
remove all created draw attributes
- Source:
(protected) drawText(arg)
Draw text
- Source:
The only legal way to draw text, support plain, latex and math text output
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg |
object | different text draw options Properties
|
(async, protected) finishTextDrawing(draw_gopt) → {Promise}
Finish text drawing
- Source:
Should be called to complete all text drawing operations
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
draw_g |
function |
<optional> |
Returns:
when text drawing completed
- Type
- Promise
(protected) getAxisToSvgFunc(isndc, noroundopt)
Return functor, which can convert x and y coordinates into pixels, used for drawing in the pad
- Source:
X and Y coordinates can be converted by calling func.x(x) and func.y(y) Only can be used for painting in the pad, means CreateG() should be called without arguments
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
isndc |
boolean | if NDC coordinates will be used |
|
noround |
boolean |
<optional> |
if set, return coordinates will not be rounded |
(protected) getCanvPainter()
returns canvas painter
- Source:
(protected) getCanvSvg() → {object}
Canvas main svg element
- Source:
Returns:
d3 selection with canvas svg
- Type
- object
getClassName()
Returns drawn object class name
- Source:
(protected) getColor(indx) → {string}
returns color from current list of colors
- Source:
First checks canvas painter and then just access global list of colors
Parameters:
Name | Type | Description |
---|---|---|
indx |
number | color index |
Returns:
with SVG color name or rgb()
- Type
- string
getDrawOpt()
Return actual draw options as string
- Source:
if options are not modified - returns original string which was specified for object draw
(protected) getFramePainter()
Returns frame painter for current pad
- Source:
Pad has direct reference on frame if any
(protected) getFrameSvg()
Returns svg element for the frame in current pad
- Source:
(protected) getG()
Returns created
- Source:
Element should be created by ObjectPainter#createG
(protected) getLayerSvg(name, pad_nameopt)
Method selects immediate layer under canvas/pad main element
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | layer name, exits 'primitives_layer', 'btns_layer', 'info_layer' |
|
pad_name |
string |
<optional> |
pad name; current pad name used by default |
(protected) getMainPainter(not_storeopt)
Returns painter for main object on the pad.
- Source:
Typically it is first histogram drawn on the pad and which draws frame axes But it also can be special usecase as TASImage or TGraphPolargram
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
not_store |
boolean |
<optional> |
if true, prevent temporary storage of main painter reference |
getObject()
Returns drawn object
- Source:
getObjectHint()
Returns string with object hint
- Source:
It is either item name or object name or class name. Such string typically used as object tooltip. If result string larger than 20 symbols, it will be cutted.
getPadName()
Returns pad name where object is drawn
- Source:
(protected) getPadPainter(pad_nameopt)
returns pad painter
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pad_name |
string |
<optional> |
pad name or use current pad by default |
(protected) getPadSvg(pad_nameopt) → {object}
Pad svg element
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pad_name |
string |
<optional> |
pad name to select, if not specified - pad where object is drawn |
Returns:
d3 selection with pad svg
- Type
- object
getSupportedDrawOptions()
Returns array with supported draw options as configured in draw.mjs
- Source:
works via pad painter and only when module was loaded
hasUserTooltip() → {boolean}
Check if user-defined tooltip function was configured
- Source:
Returns:
flag is user tooltip handler was configured
- Type
- boolean
(protected) isMainPainter()
Returns true if this is main painter
- Source:
(protected) matchObjectType(arg)
Checks if drawn object matches with provided typename
- Source:
Parameters:
Name | Type | Description |
---|---|---|
arg |
string | object | typename (or object with _typename member) |
(abstract, protected) redraw()
Redraw object
- Source:
Basic method, should be reimplemented in all derived objects for the case when drawing should be repeated
(protected) redrawObject(obj, optopt) → {boolean|Promise}
Central place to update objects drawing
- Source:
Two actions typically done by redraw - update object content via ObjectPainter#updateObject
and
then redraw correspondent pad via ObjectPainter#redrawPad
. If possible one should redefine
only updateObject function and keep this function unchanged. But for some special painters this function is the
only way to control how object can be update while requested from the server
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
object | new version of object, values will be updated in original object |
|
opt |
string |
<optional> |
when specified, new draw options |
Returns:
for object redraw
- Type
- boolean | Promise
(async, protected) redrawPad(reasonopt) → {Promise}
Redraw all objects in the current pad
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
reason |
string |
<optional> |
like 'resize' or 'zoom' |
Returns:
when pad redraw completed
- Type
- Promise
(protected) removeFromPadPrimitives()
Remove painter from pad list of painters
- Source:
(protected) removeG()
removes
- Source:
generic method to delete all graphical elements, associated with the painter
(protected) scaleTextDrawing(factor, draw_gopt)
Apply scaling factor to all drawn text in the
- Source:
Can be applied at any time before finishTextDrawing is called - even in the postprocess callbacks of text draw
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
factor |
number | scaling factor |
|
draw_g |
object |
<optional> |
drawing element for the text |
(protected) setAsMainPainter()
Assign this as main painter on the pad
- Source:
Main painter typically responsible for axes drawing Should not be used by pad/canvas painters, but rather by objects which are drawing axis
(protected) setPadName(pad_nameopt)
Assigns pad name where element will be drawn
- Source:
Should happend before first draw of element is performed, only for special use case
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pad_name |
string |
<optional> |
on which subpad element should be draw, if not specified - use current |
(protected) showInspector()
Show object in inspector for provided object
- Source:
(protected) showInspector()
Show object in inspector for provided object
- Source:
(protected) startTextDrawing(font_face, font_size, draw_gopt, max_font_sizeopt)
Start text drawing
- Source:
required before any text can be drawn
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
font_face |
number | font id as used in ROOT font attributes |
|
font_size |
number | font size as used in ROOT font attributes |
|
draw_g |
object |
<optional> |
element where text drawm, by default using main object |
max_font_size |
number |
<optional> |
maximal font size, used when text can be scaled |
(protected) svgToAxis(axis, coord, ndc) → {number}
Converts pad SVG x or y coordinates into axis values.
- Source:
Reverse transformation for ObjectPainter#axisToSvg
Parameters:
Name | Type | Description |
---|---|---|
axis |
string | name like 'x' or 'y' |
coord |
number | graphics coordiante. |
ndc |
boolean | kind of return value |
Returns:
value of requested coordiantes
- Type
- number
(protected) updateObject(obj, optopt)
Generic method to update object content.
- Source:
Default implementation just copies first-level members to current object
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
object | object with new data |
|
opt |
string |
<optional> |
option which will be used for redrawing |