*Example of an options definition with the most common attributes:

this.prototype.options = {
'chartType': {
type: 'number',
[name: 'Name'],
[_set: function],
[value: 'line'], // options without value get forwarded to the _get callback
[_get: function], // either _get or value must be specified
[flags: BG.charts.Object.EOptionFlags.EXPOSED] // various flags; e.g. exposed => hint for ui; this option can be shown
},
};

Hierarchy (View Summary)

Constructors

  • This class implements two dimensional chart with one X-Axis, and one or more Y-Axes (represented by BG.charts.Scale). Charts are always contained inside a BG.charts.ChartSet where they share the same X-Axis.

    The chart object is mainly responsible for event handling, and managing a set of tools (BG.charts.Tool), layers (BG.charts.Layers), and legend entries (BG.charts.LegendEntry).

    Depending on the type of displayed layers, the X-Axis can be synced/locked to one or more Y-Axis, meaning that manipulating the scale of either will also affect the other. For example, this is used in Point and Figure charts, to ensure a constant aspect ratio.

    Parameters

    Returns BG.charts.Chart

Properties

optionGroups: OptionGroup[]
options: { [key: string]: any }

Methods

  • Type Parameters

    • Type extends (keyof Events) | (keyof Events)
    • Callback extends
          | (object: null | BG.charts.Object) => void
          | (hovered: null | boolean | BG.charts.LegendEntry) => void
          | (
              event: null | Event,
              point: Point,
              objects: BG.charts.Object[],
              chart: BG.charts.Chart,
          ) => void
          | (event: null | Event, point: Point, object: BG.charts.Object) => void
          | (tool: BG.charts.Tool) => void
          | (scale: BG.charts.Scale) => void
          | (scale: BG.charts.Scale) => void
          | () => void
          | (objects: null | BG.charts.Object[]) => void
          | () => void
          | (
              optionName: string,
              attributeName: string,
              oldValue: any,
              newValue: any,
          ) => void
          | (optionName: string, oldValue?: any, newValue?: any) => void
          | (
              state: BG.charts.Object.State,
              flags: BG.charts.Object.State.EFlags,
          ) => void
          | () => void

    Parameters

    Returns this

    adds a listener to the end of the listeners array for the specified event.

  • returns or sets the attribute of an option this function should be used with care - modifications of internal properties might break stuff!

    Parameters

    • this: BG.charts.Object<Record<string, (...args: any) => void>>
    • s: string
    • a: string
    • Optionalv: any

    Returns any

  • must be called after willUpdateOptions once all actions that might potentially changed values of any options are done

    IMPORTANT: methods must be called in balance; e.g. for each call to willUpdateOptions, you must call didUpdateOptions exactly once.

    Parameters

    Returns void

  • draw a horizontal marker this method should only be called while the chart is redrawing (e.g. from a tools draw routine)

    if the important parameter is set to true, marker is also drawn when xAxis is not visible

    Parameters

    • index: number
    • color: string
    • Optionalorder: number
    • Optionalimportant: boolean

    Returns void

  • draw a tooltip with originating from the supplied rectangle,

    Parameters

    • x: number

      upper left x coordinate

    • y: number

      upper left y coordinate

    • w: number

      width of rectangle

    • h: number

      height of rectangle

    • text: string

    Returns void

  • draw a vertical marker with the specified property this method should only be called while the chart is redrawing (e.g. from a tools draw routine)

    if the important parameter is set to true, marker is also drawn when xAxis is not visible

    Parameters

    • marker: Omit<Marker, "textColor">

    Returns void

  • Type Parameters

    • Type extends (keyof Events) | (keyof Events)
    • Callback extends
          | (object: null | BG.charts.Object) => void
          | (hovered: null | boolean | BG.charts.LegendEntry) => void
          | (
              event: null | Event,
              point: Point,
              objects: BG.charts.Object[],
              chart: BG.charts.Chart,
          ) => void
          | (event: null | Event, point: Point, object: BG.charts.Object) => void
          | (tool: BG.charts.Tool) => void
          | (scale: BG.charts.Scale) => void
          | (scale: BG.charts.Scale) => void
          | () => void
          | (objects: null | BG.charts.Object[]) => void
          | () => void
          | (
              optionName: string,
              attributeName: string,
              oldValue: any,
              newValue: any,
          ) => void
          | (optionName: string, oldValue?: any, newValue?: any) => void
          | (
              state: BG.charts.Object.State,
              flags: BG.charts.Object.State.EFlags,
          ) => void
          | () => void

    Parameters

    Returns boolean

    execute each of the listeners in order with the supplied parameters.

  • returns a flat representation of all available config options in the form of a key-value-object optionally only values that are not read-only can be returned

    IMPORTANT: this method will always convert I18NStrings to strings, so for displaying strings in a UI use individual calls to BG.charts.Object:get instead

    Parameters

    • OptionalreadWriteOnly: boolean

      default: true

    • OptionalmodifiedOnly: boolean

      default: true

    • OptionalnonEphemeralOnly: boolean

      default: true

    Returns { [key: string]: any }

  • focus the specified tool; on the next input event, the tools handleEvent function will be called

    Parameters

    Returns void

  • returns the value of the requested option, or a list of all available config options if no parameter is specified.

    Parameters

    • Optionals: string
    • Optionalflags: number

    Returns any

  • returns the bounds of the values currently displayed by this chart

    Parameters

    • Optionalscale: number

    Returns undefined | null | Bounds

  • returns the categorization of the objects options can be used for displaying a more structured user interface

    Returns OptionGroup[]

  • returns the identifier for the specified index

    Parameters

    • index: number

      a valid index

    Returns number

    the identifier

  • returns the index for the specified x coordinate

    Parameters

    • x: number

      the x coordinate in pixels

    Returns number

    the index

  • returns the identifier for the specified index

    Parameters

    • identifier: number

      a valid identifier

    Returns number

    the index

  • returns the numeric offset for the specified index will only be non-zero if the timestamp at the specified index is not distinct

    offset should be used in combination with the return value of getIdentifierByIndex

    Parameters

    • index: number

      an index

    Returns number

    numeric offset

  • returns the bounds of the charts plot area

    Returns Bounds

  • returns the inset values for all plot area edges plugins or tools should not draw any interactive elements within these areas

    Returns EdgeInsets

  • returns the reference ohlc input or null if not available

    Returns null | TOHLCSet

  • retrieve custom y scale identified by specified id

    Parameters

    • Optionalid: number

    Returns null | BG.charts.Scale

  • returns the tick width of this chart

    Returns number

  • returns the value for the specified y coordinate

    Parameters

    • y: number

      the y coordinate in pixels

    • Optionalscale: number

    Returns number

    the value in chart units

  • returns the x coordinate for the specified index

    Parameters

    • index: number

      the index

    Returns number

    x coordinate in pixels

  • returns the y coordinate for the specified value

    Parameters

    • value: number

      the value in chart units

    • Optionalscale: number

    Returns number

    y coordinate in pixels

  • Type Parameters

    • Type extends (keyof Events) | (keyof Events)
    • Callback extends
          | (object: null | BG.charts.Object) => void
          | (hovered: null | boolean | BG.charts.LegendEntry) => void
          | (
              event: null | Event,
              point: Point,
              objects: BG.charts.Object[],
              chart: BG.charts.Chart,
          ) => void
          | (event: null | Event, point: Point, object: BG.charts.Object) => void
          | (tool: BG.charts.Tool) => void
          | (scale: BG.charts.Scale) => void
          | (scale: BG.charts.Scale) => void
          | () => void
          | (objects: null | BG.charts.Object[]) => void
          | () => void
          | (
              optionName: string,
              attributeName: string,
              oldValue: any,
              newValue: any,
          ) => void
          | (optionName: string, oldValue?: any, newValue?: any) => void
          | (
              state: BG.charts.Object.State,
              flags: BG.charts.Object.State.EFlags,
          ) => void
          | () => void

    Parameters

    Returns Callback[]

    returns an array of listeners for the specified event.

  • Type Parameters

    • Type extends (keyof Events) | (keyof Events)
    • Callback extends
          | (object: null | BG.charts.Object) => void
          | (hovered: null | boolean | BG.charts.LegendEntry) => void
          | (
              event: null | Event,
              point: Point,
              objects: BG.charts.Object[],
              chart: BG.charts.Chart,
          ) => void
          | (event: null | Event, point: Point, object: BG.charts.Object) => void
          | (tool: BG.charts.Tool) => void
          | (scale: BG.charts.Scale) => void
          | (scale: BG.charts.Scale) => void
          | () => void
          | (objects: null | BG.charts.Object[]) => void
          | () => void
          | (
              optionName: string,
              attributeName: string,
              oldValue: any,
              newValue: any,
          ) => void
          | (optionName: string, oldValue?: any, newValue?: any) => void
          | (
              state: BG.charts.Object.State,
              flags: BG.charts.Object.State.EFlags,
          ) => void
          | () => void

    Parameters

    Returns this

    alias for addListener

  • Type Parameters

    • Type extends (keyof Events) | (keyof Events)
    • Callback extends
          | (object: null | BG.charts.Object) => void
          | (hovered: null | boolean | BG.charts.LegendEntry) => void
          | (
              event: null | Event,
              point: Point,
              objects: BG.charts.Object[],
              chart: BG.charts.Chart,
          ) => void
          | (event: null | Event, point: Point, object: BG.charts.Object) => void
          | (tool: BG.charts.Tool) => void
          | (scale: BG.charts.Scale) => void
          | (scale: BG.charts.Scale) => void
          | () => void
          | (objects: null | BG.charts.Object[]) => void
          | () => void
          | (
              optionName: string,
              attributeName: string,
              oldValue: any,
              newValue: any,
          ) => void
          | (optionName: string, oldValue?: any, newValue?: any) => void
          | (
              state: BG.charts.Object.State,
              flags: BG.charts.Object.State.EFlags,
          ) => void
          | () => void

    Parameters

    Returns this

    adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.

  • called when an object will be permanently discarded no other methods will be called on it ever again after this point

    IMPORTANT: this method should ONLY be called directly on the Controller all other objects will be destroyed automatically by the implementation

    Returns void

  • life cycle method; called when the object should recover from an error and resume normal operation

    this will only be called if the object encountered a RecoverableError, and is always triggered by a manual user interaction

    always called between start and stop

    Returns void

  • life cycle method; called when the object should start normal operation at this point is is already completely initialized

    Parameters

    Returns void

  • life cycle method; called when the object should stop normal operation if objects have any pending subscriptions/requests, they should all be stopped here

    the object is also responsible for clearing the loading flag from it's state if it is currently active failing to do so will trigger a fatal error

    object might be started again afterwards (start) or destroyed (destroy) this is not known yet at this point

    called after start or restart

    Returns void

  • can be called to tell the object that it should recover from an error and resume will have no effect if no retryable error is currently associated with the object

    Returns boolean

  • Type Parameters

    • Type extends (keyof Events) | (keyof Events)

    Parameters

    Returns this

    removes all listeners, or those of the specified event.

  • Type Parameters

    • Type extends (keyof Events) | (keyof Events)
    • Callback extends
          | (object: null | BG.charts.Object) => void
          | (hovered: null | boolean | BG.charts.LegendEntry) => void
          | (
              event: null | Event,
              point: Point,
              objects: BG.charts.Object[],
              chart: BG.charts.Chart,
          ) => void
          | (event: null | Event, point: Point, object: BG.charts.Object) => void
          | (tool: BG.charts.Tool) => void
          | (scale: BG.charts.Scale) => void
          | (scale: BG.charts.Scale) => void
          | () => void
          | (objects: null | BG.charts.Object[]) => void
          | () => void
          | (
              optionName: string,
              attributeName: string,
              oldValue: any,
              newValue: any,
          ) => void
          | (optionName: string, oldValue?: any, newValue?: any) => void
          | (
              state: BG.charts.Object.State,
              flags: BG.charts.Object.State.EFlags,
          ) => void
          | () => void

    Parameters

    Returns this

    remove a listener from the listener array for the specified event.

  • will set validate and then set the specified option(s) to the provided value(s) after validation

    NOTE: if multiple options are used, will return false if at least one value is not valid values are applied individually however, so one option might be set even if the value for another is invalid

    Parameters

    Returns boolean

  • highlight the specified buttons

    Parameters

    • buttons: string[]

    Returns void

  • Parameters

    • maxListeners: number

    Returns this

    by default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that limit to be increased. Set to zero for unlimited.

  • Sets the objName and objType of the Object reverts to the default ones if no arguments are given

    Parameters

    • OptionalobjType: string
    • OptionalobjName: string

    Returns void

  • snap point to the nearest value of interest

    Parameters

    • point: Point

      the point to be snapped

    • range: number

      the maximum allowed distance from the nearest value

    Returns false | Point

    false if the point was not snappoed, otherwise the snapped Point

  • Returns a string representation of an object.

    Returns string

  • will set validate value(s) for the specified option(s)

    NOTE: if multiple options are used, will return false if at least one value is not valid

    Parameters

    Returns boolean

  • when using custom getters/setters (via _get/_set) in options, the values of options can change without .set being called - or there might not even be a setter for readonly options; for example, if the getter simply returns the value of a member variable this variable could be modified directly. In this case, events such as optionChanged would not be fired, and listeners would not be informed about the change.

    To account for such cases, the methods willUpdateOptions and didUpdateOptions should be called directly BEFORE and AFTER actions that might potentially change values of options. the correct events will then automatically be triggered when calling didUpdateOptions.

    if the options that could change are known, they can be supplied via the optional parameter. This provides a small performance gain in most situations.

    IMPORTANT: methods must be called in balance; e.g. for each call to willUpdateOptions, you must call didUpdateOptions exactly once.

    Parameters

    • Optionaloptions: string | string[]

    Returns void

  • Parameters

    • cb: Function

    Returns void

    set custom error handler for event listeners

  • Parameters

    • maxListeners: number

    Returns void

    set default amount for limit warning