Namespace: Painter

JSROOT. Painter

Methods

staticJSROOT.Painter.addColor(rgb){number}

Add new color

Name Type Description
rgb string

color name or just string with rgb value

Returns:
Type Description
number index of new color

staticJSROOT.Painter.closeMenu(menuname)

Close previousely created and shown JSROOT menu

Name Type Description
menuname string optional

optional menu name

staticJSROOT.Painter.createMenu(evnt, handler, menuname)

Create JSROOT menu

See JSROOT.Painter.jQueryMenu class for detailed list of methods

Name Type 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

Example
JSROOT.require("painter")
      .then(jsrp => jsrp.createMenu())
      .then(menu => {
         menu.add("First", () => console.log("Click first"));
         let flag = true;
         menu.addchk(flag, "Checked", arg => console.log(`Now flag is ${arg}`));
         menu.show();
       });

staticJSROOT.Painter.ensureTCanvas(painter, frame_kind)

Ensure TCanvas and TFrame for the painter object

Assign divid, creates TCanvas if necessary, add to list of pad painters

Name Type Description
painter Object

painter object to process

frame_kind string | boolean

false for no frame or "3d" for special 3D mode

staticJSROOT.Painter.floatToString(value, fmt, ret_fmt){string|Array}

Converts numeric value to string according to specified format.

Name Type Default Description
value number

value to convert

fmt string "6.4g" optional

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:
Type Description
string | Array
  • converted value or array with value and actual format

staticJSROOT.Painter.getColor(){String}

Return ROOT color by index

Color numbering corresponds typical ROOT colors

Returns:
Type Description
String with RGB color code or existing color name like 'cyan'