Options
All
  • Public
  • Public/Protected
  • All
Menu

Module graphics/GraphicsResponse

Type aliases

GraphicsObject: DisplayObject & GraphicsScope

A type that describes the intersection between DisplayObject and GraphicsScope.

 ...
//in this example map returns a global text label at the last bar's
//index on the X-axis and 40 pixels above the price 3850 in the Y-axis.
 map(d) {
     return {
         graphics: d.isLast() && {
             items: [
                 {
                     tag: 'Text',
                     key: 'myLabel',
                     point: {
                         x: du(d.index()),
                         y: op(du(3850), '-', px(40))
                     },
                     text: '-> 3850',
                     style: { fill: '#f00' },
                     textAlignment: 'centerMiddle',
                     global: true, //<- indicates this is a globally-scoped object
                     origin: {     //<- indicates (0,0) is (right, top) oriented
                         cs: 'grid',
                         h: 'right',
                         v: 'top',
                     }
                 }
             ]
         }
     }
 }
GraphicsScope: object

The scope of the GraphicsObject. This consists of its origin in the given space, whether or not it is a global (single render) object, and the scalar condition under which the object should or should not be drawn.

Type declaration

ScaleRange: object

A range in pixels per domain unit.

Type declaration

  • Optional Readonly max?: number
  • Optional Readonly min?: number
VisibilityConditions: object

Defines an object that describes the minimum and maximum scalar conditions that must exist for this object to be drawn. This scale is measured in pixels per domain unit. This means that X represents roughly the pixels between bars, and Y is the tick size of the contract.

 //adding this condition will cause our text object to render only at px/du > 10
 ...
 items: [
     {
         conditions: {
           scaleRangeX: { min: 10 }
         },
         tag: 'Text',
         key: 'myText',
         text: 'rendered!',
         alignment: 'centerMiddle',
         point: {
             x: du(d.index()),
             y: op(du(d.value()), '-', px(50))
         },
         style: { fontSize: 18, fill: "red" },
     }
 ]
 ...

Type declaration

  • Optional scaleRangeX?: ScaleRange

    Optional. Roughly equal to the min and/or max number of px between bars required for this object to render.

  • Optional scaleRangeY?: ScaleRange

    Optional. The min and or max pixels per tick for this object's contract dependency required for this object to render.

Generated using TypeDoc