new ObjectPainter(dom, obj, optopt)
Painter class for ROOT objects
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dom |
object | string | dom element or identifier or pad painter |
|
obj |
object | object to draw |
|
opt |
string |
<optional> |
object draw options |
Methods
(protected) addColor() → {number}
Add color to list of colors
- Description:
Returned color index can be used as color number in all other draw functions
- Source:
Returns:
new color index
- Type
- number
(protected) addToPadPrimitives()
Add painter to pad list of painters
- Description:
Normally called from
ensureTCanvas
function when new painter is created
- Source:
(protected) assignObject()
Assign object to the painter
- Source:
(protected) axisToSvg(axis, value, ndc, noroundopt) → {number}
Converts x or y coordinate into pad SVG coordinates.
- Description:
Only can be used for painting in the pad, means CreateG() should be called without arguments
- Source:
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 coordinates
- Type
- number
bringToFront()
Bring draw element to the front
- Source:
(protected) cleanup()
Generic method to cleanup painter.
- Description:
Remove object drawing and (in case of main painter) also main HTML components
- Source:
configureUserClickHandler(handler)
Configure user-defined click handler
- Description:
Function will be called every time when frame click was performed As argument, tooltip object with selected bins will be provided If handler function returns true, default handling of click will be disabled
- Source:
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | function called when mouse click is done |
configureUserContextMenu(fillmenu_func)
Configure user-defined context menu for the object
- Description:
fillmenu_func will be called when context menu is activated Arguments fillmenu_func are (menu,kind) First is menu object, second is object sub-element like axis 'x' or 'y' Function should return promise with menu when items are filled
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fillmenu_func |
function | function to fill custom context menu for object |
configureUserDblclickHandler(handler)
Configure user-defined dblclick handler
- Description:
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
- Source:
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | function called when mouse double click is done |
configureUserTooltipHandler(handler, tmoutopt)
Configure user-defined tooltip handler
- Description:
Hook for the users to get tooltip information when mouse cursor moves over frame area Handler function will be called every time when new data is selected when mouse leave frame area, handler(null) will be called
- Source:
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(argsopt)
Creates fill attributes object.
- Description:
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
- Source:
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object |
<optional> |
for special cases one can specify TAttFill as args or number of parameters Properties
|
Returns:
created handle
(protected) createAttLine(args)
Creates line attributes object.
- Description:
Can be used to produce lines in painter. See
TAttLineHandler
for more info. Instance assigned as this.lineatt data member, recognized by GED editor
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
object | either TAttLine or see constructor arguments of |
(protected) createAttMarker(args) → {object}
Creates marker attributes object
- Description:
Can be used to produce markers in painter. See
TAttMarkerHandler
for more info. Instance assigned as this.markeratt data member, recognized by GED editor
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
object | either TAttMarker or see arguments of |
Returns:
created handler
- Type
- object
(protected) createAttText(args)
Creates text attributes object.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
object | either TAttText or see constructor arguments of |
(protected) createG(frame_layeropt)
(re)creates svg:g element for object drawings
- Description:
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)
- Source:
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
- Description:
The only legal way to draw text, support plain, latex and math text output
- Source:
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg |
object | different text draw options Properties
|
(async, protected) finishTextDrawing(draw_gopt) → {Promise}
Finish text drawing
- Description:
Should be called to complete all text drawing operations
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
draw_g |
function |
<optional> |
Returns:
when text drawing completed
- Type
- Promise
(protected) getAxisToSvgFunc(isndc, noroundopt, use_frame_coordinatesopt)
Return functor, which can convert x and y coordinates into pixels, used for drawing in the pad
- Description:
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
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
isndc |
boolean | if NDC coordinates will be used |
|
noround |
boolean |
<optional> |
if set, return coordinates will not be rounded |
use_frame_coordinates |
boolean |
<optional> |
use frame coordinates even when drawing on the pad |
(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
- Description:
First checks canvas painter and then just access global list of colors
- Source:
Parameters:
Name | Type | Description |
---|---|---|
indx |
number | color index |
Returns:
with SVG color name or rgb()
- Type
- string
(protected) getDrawDom()
Return dom argument for object drawing
- Description:
Can be used to draw other objects on same pad / same dom element
- Source:
getDrawOpt(ignore_pad)
Return actual draw options as string
- Description:
if options are not modified - returns original string which was specified for object draw
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ignore_pad |
do not include pad settings into histogram draw options |
(protected) getFramePainter()
Returns frame painter for current pad
- Description:
Pad has direct reference on frame if any
- Source:
(protected) getFrameSvg()
Returns svg element for the frame in current pad
- Source:
(protected) getG()
Returns created
- Description:
Element should be created by
ObjectPainter#createG
- Source:
(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.
- Description:
Typically it is first histogram drawn on the pad and which draws frame axes But it also can be special use-case as TASImage or TGraphPolargram
- Source:
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
- Description:
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.
- Source:
getObjectName()
Returns drawn object name
- Source:
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
getSnapId()
Provides identifier on server for requested sub-element
- Source:
getSupportedDrawOptions()
Returns array with supported draw options as configured in draw.mjs
- Description:
works via pad painter and only when module was loaded
- Source:
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
- Description:
Basic method, should be reimplemented in all derived objects for the case when drawing should be repeated
- Source:
(protected) redrawObject(obj, optopt) → {boolean|Promise}
Central place to update objects drawing
- Description:
Two actions typically done by redraw - update object content via
ObjectPainter#updateObject
and then redraw correspondent pad viaObjectPainter#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
- Source:
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
- Description:
generic method to delete all graphical elements, associated with the painter
- Source:
(protected) scaleTextDrawing(factor, draw_gopt)
Apply scaling factor to all drawn text in the
- Description:
Can be applied at any time before finishTextDrawing is called - even in the postprocess callbacks of text draw
- Source:
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
- Description:
Main painter typically responsible for axes drawing Should not be used by pad/canvas painters, but rather by objects which are drawing axis
- Source:
(protected) setPadName(pad_nameopt)
Assigns pad name where element will be drawn
- Description:
Should happened before first draw of element is performed, only for special use case
- Source:
- Deprecated:
- to be removed in v8
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pad_name |
string |
<optional> |
on which sub-pad 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
- Description:
required before any text can be drawn
- Source:
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 drawn, 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.
- Description:
Reverse transformation for
ObjectPainter#axisToSvg
- Source:
Parameters:
Name | Type | Description |
---|---|---|
axis |
string | name like 'x' or 'y' |
coord |
number | graphics coordinate. |
ndc |
boolean | kind of return value |
Returns:
value of requested coordinates
- Type
- number
(protected) updateObject(obj, optopt)
Generic method to update object content.
- Description:
Default implementation just copies first-level members to current object
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
object | object with new data |
|
opt |
string |
<optional> |
option which will be used for redrawing |