Class: TObjectPainter

JSROOT. TObjectPainter

new JSROOT.TObjectPainter(obj)

Basic painter for objects inside TCanvas/TPad.

Basic painter for objects inside TCanvas/TPad.

Name Type Description
obj object

object to draw

Extends

Methods

Generic method to cleanup painter.

Remove object drawing and in case of main painter - also main HTML components

createAttFill(args)

Creates fill attributes object.

Method dedicated to create fill attributes, bound to canvas SVG otherwise newly created patters will not be usable in the canvas See JSROOT.TAttFillHandler for more info. Instance assigned as this.fillatt data member, recognized by GED editor

Name Type Description
args object

for special cases one can specify TAttFill as args or number of parameters

Name Type Default Description
std boolean true optional

this is standard fill attribute for object and should be used as this.fillatt

attr object null optional

object, derived from TAttFill

pattern number optional

integer index of fill pattern

color number optional

integer index of fill color

color_as_svg string optional

color will be specified as SVG string, not as index from color palette

kind number optional

some special kind which is handled differently from normal patterns

Returns:
created handle

createAttLine(args)

Creates line attributes object.

Can be used to produce lines in painter. See JSROOT.TAttLineHandler for more info. Instance assigned as this.lineatt data member, recognized by GED editor

Name Type Description
args object

either TAttLine or see constructor arguments of JSROOT.TAttLineHandler

createAttMarker(args)

Creates marker attributes object.

Can be used to produce markers in painter. See JSROOT.TAttMarkerHandler for more info. Instance assigned as this.markeratt data member, recognized by GED editor

Name Type Description
args object

either TAttMarker or see arguments of JSROOT.TAttMarkerHandler

Returns:
created handler

CreateG(frame_layer)

(re)creates svg:g element for object drawings

either one attach svg:g to pad list of primitives (default) or svg:g element created in specified frame layer (default main_layer)

Name Type Description
frame_layer string optional

when specified, element will be created inside frame layer, otherwise in pad primitives list

DeleteThis()

Remove painter from list of painters and cleanup all drawings

DrawText(arg)

draw text

Name Type Description
arg object

different text draw options

Name Type Default Description
text string

text to draw

align number 12 optional

int value like 12 or 31

align string optional

end;bottom

x number 0 optional

x position

y number 0 optional

y position

width number optional

when specified, adjust font size in the specified box

height number optional

when specified, adjust font size in the specified box

latex number

0 - plain text, 1 - normal TLatex, 2 - math

color string black optional

text color

rotate number optional

rotaion angle

font_size number optional

fixed font size

draw_g object this.draw_g optional

element where to place text, if not specified central painter container is used

FinishTextDrawing()

Finish text drawing

Should be called to complete all text drawing operations

frame_height()

Returns frame height

frame_width()

Returns frame width

Returns frame X coordinate relative to current pad

Returns frame Y coordinate relative to current pad

GetClassName()

Returns drawn object class name

Returns drawn object

is_main_painter()

Returns true if this is main painter

main_painter(not_store, pad_name)

Returns main object painter on the pad.

Normally this is first histogram drawn on the pad, which also draws all axes

Name Type Description
not_store boolean optional

if true, prevent temporary store of main painter reference

pad_name string optional

when specified, returns main painter from specified pad

MatchObjectType(arg)

Checks if drawn object matches with provided typename

Name Type Description
arg string

typename

Name Type Description
_typename string

if arg is object, use its typename

abstractRedraw()

Redraw object

Basic method, should be reimplemented in all derived objects for the case when drawing should be repeated

inherited RedrawObject(obj){boolean}

Updates object and readraw it

Name Type Description
obj object

new version of object, values will be updated in original object

Returns:
Type Description
boolean true if object updated and redrawn

Redraw all objects in correspondent pad

RemoveDrawG()

removes element with object drawing

generic method to delete all graphical elements, associated with painter

Returns d3.select for main element for drawing, defined with this.divid.

if main element was layouted, returns main element inside layout

SetDivId(divid, kind, pad_name)

Assigns id of top element (normally div where drawing is done).

In some situations canvas may not exists - for instance object drawn as html, not as svg. In such case the only painter will be assigned to the first element

Following value of is_main parameter is allowed: -1 - only assign id, this painter not add to painters list, 0 - normal painter (default), 1 - major objects like TH1/TH2 (required canvas with frame) 2 - if canvas missing, create it, but not set as main object 3 - if canvas and (or) frame missing, create them, but not set as main object 4 - major objects like TH3 (required canvas and frame in 3d mode) 5 - major objects like TGeoVolume (do not require canvas)

Name Type Default Description
divid string | object

id of div element or directly DOMElement

kind number 0 optional

kind of object drawn with painter

pad_name string optional

when specified, subpad name used for object drawin

ShowInpsector()

StartTextDrawing()

Start text drawing

required before any text can be drawn

UpdateObject(obj)

Generic method to update object content.

Just copy all members from source object

Name Type Description
obj object

object with new data