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
(private) _checkAllTextDrawing()
Analyze if all text draw operations are completed
- Source:
(private) _postprocessDrawText()
Post-process plain text drawing
- Source:
(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(pad_nameopt)
Add painter to pad list of painters
- Description:
Normally one should use
ensureTCanvas
to add painter to pad list of primitives
- Source:
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:
(private) assignSnapId()
Assign snapid to the painter
- Description:
Identifier used to communicate with server side and identifies object on the server
- 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 coordiantes
- Type
- number
bringToFront()
Bring draw element to the front
- Source:
(private) checkResize()
Checks if draw elements were resized and drawing should be updated.
- Description:
Redirects to
TPadPainter#checkCanvasResize
- 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 perfromed 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 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
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fillmenu_func |
function | function to fill custom context menu for oabject |
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 Hanlder 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(args)
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 | 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.
- 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:
(async, private) drawInSpecialArea(obj, opt, kind)
Draw in special projection areas
- Source:
Parameters:
Name | Type | Description |
---|---|---|
obj |
object to draw |
|
opt |
draw option |
|
kind |
'', 'X', 'Y' |
(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
|
(private) executeMenuCommand()
execute selected menu command, either locally or remotely
- Source:
(private) fillContextMenu()
Fill context menu for the object
- Source:
(async, private) fillObjectExecMenu()
Fill object menu in web canvas
- Source:
(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
(private) forEachPainter()
call function for each painter in the pad
- Description:
Iterate over all known painters
- Source:
(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
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 usecase 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 sublement
- 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:
(private) getToolTip(evnt)
Get tooltip for painter and specified event position
- Source:
Parameters:
Name | Type | Description |
---|---|---|
evnt |
Object | object wiith clientX and clientY positions |
(private) getUniqueId()
Assign unique identifier for the painter
- Source:
hasUserTooltip() → {boolean}
Check if user-defined tooltip function was configured
- Source:
Returns:
flag is user tooltip handler was configured
- Type
- boolean
(async, private) interactiveRedraw() → {Promise}
indicate that redraw was invoked via interactive action (like context menu or zooming)
- Description:
Use to catch such action by GED and by server-side
- Source:
Returns:
when completed
- Type
- Promise
(private) isBatchMode()
Indicates that drawing runs in batch mode
- Source:
(protected) isMainPainter()
Returns true if this is main painter
- Source:
(private) isSecondary()
Check if this is secondary painter
- Description:
if main painter provided - check if this really main for this
- Source:
(private) isTooltipAllowed()
returns tooltip allowed flag
- Description:
If available, checks in canvas 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) |
(async, private) provideSpecialDrawArea(kind)
Provide projection areas
- Source:
Parameters:
Name | Type | Description |
---|---|---|
kind |
'X', 'Y', 'XY' or '' |
(private) provideUserTooltip(data)
Provide tooltips data to user-defined function
- Source:
Parameters:
Name | Type | Description |
---|---|---|
data |
object | tooltip data |
(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 |
(private) selectCurrentPad(new_nameopt) → {string}
Method selects current pad name
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
new_name |
string |
<optional> |
when specified, new current pad name will be configured |
Returns:
previous selected pad or actual pad when new_name not specified
- Type
- string
(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:
(private) setItemName()
Change item name
- Description:
When available, used for svg:title proprty
- Source:
(protected) setPadName(pad_nameopt)
Assigns pad name where element will be drawn
- Description:
Should happend before first draw of element is performed, only for special use case
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pad_name |
string |
<optional> |
on which subpad element should be draw, if not specified - use current |
(private) setSecondaryId()
Assign secondary id
- Source:
(private) setTooltipAllowed(onopt)
change tooltip allowed flag
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
on |
boolean | string |
<optional> |
true
|
set tooltip allowed state or 'toggle' |
(protected) showInspector()
Show object in inspector for provided object
- Source:
(protected) showInspector()
Show object in inspector for provided object
- Source:
(private) showObjectStatus()
shows objects status
- Description:
Either used canvas painter method or globaly assigned When no parameters are specified, just basic object properties are shown
- 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 drawm, by default using main object |
max_font_size |
number |
<optional> |
maximal font size, used when text can be scaled |
(private) storeDrawOpt()
Store actual this.options together with original string
- Source:
(private) submitCanvExec()
Invoke method for object via WebCanvas functionality
- Description:
Requires that painter marked with object identifier (this.snapid) or identifier provided as second argument Canvas painter should exists and in non-readonly mode Execution string can look like 'Print()'. Many methods call can be chained with 'Print();;Update();;Clear()'
- Source:
(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 coordiante. |
ndc |
boolean | kind of return value |
Returns:
value of requested coordiantes
- 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 |