id of the parent div
backend specific options
Optional
canvasConstructor: (width: number, height: number, type?: "pdf" | "svg") => CanvasCreates a Canvas instance. This function works in both Node.js and Web browsers, where there is no Canvas constructor.
Optional
type: "pdf" | "svg"Optionally specify to create a PDF or SVG canvas. Defaults to an image canvas.
Optional
Readonly
eventsOptional
optionProtected
optionsStatic
optionscurrently active action (read only). Valid values:
controls the size of buttons
total height of the set
i18n language
i18n locale
i18n timezone
enable/disable mouse and keyboard interaction
check if user interaction (click or touch) is currently in progress
enable/disable buttons in charts
enable/disable buttons in legends
enable/disable modification of the chartsets content through mouse/touch interaction
enable/disable manual interactive reordering of charts
enable/disable manual interactive resizing of charts
enable/disable manual interactive scrolling of the xAxis
enable/disable manual interactive scrolling of the xAxis
controls wether layers such as line and mountain use linear interpolation between data points disabling interpolation can make sense for some kinds of data such as measurements
(can only be configured via stylesheet)
enables/disables legend completely, regardless of the legendStyle configured for individual charts
enable/disable picker (value cursor)
width of the set usable for plotting (width excluding y axes on the outside)
(can only be configured via stylesheet)
scale factor affecting the size of the set (0.0 - 1.0)
controls the ChartSets resizing behaviour Valid values:
retrieves current y-axis placeholder mode When y-axes are placed on the outside, this option controls if the primary axis is rendered twice if a chart has no secondary y-axis.
Valid values:
(can only be configured via stylesheet)
enable/disable automatic snapping to OHLC values or tool handles
range in pixels for automatic snapping
width of the set
retrieves current x-axis layout
(can only be configured via stylesheet)
retrieves the initial amount of blank space between the last value and the yAxis.
(can only be configured via stylesheet)
this value is not used by the ChartSet implementation itself; it is just a hint for anyone who creates a layout for this ChartSet. ranges between 0% (no space) and 50% (50% empty space on the right).
NOTE: displayed spacing might be slightly larger than the requested value due to layout constraints.
retrieves current y-axis layout
(can only be configured via stylesheet)
returns or sets the attribute of an option this function should be used with care - modifications of internal properties might break stuff!
Optional
v: anymust 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.
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 Object:get instead
Optional
readWriteOnly: booleandefault: true
Optional
modifiedOnly: booleandefault: true
Optional
nonEphemeralOnly: booleandefault: true
returns the value of the requested option, or a list of all available config options if no parameter is specified.
Optional
s: stringOptional
flags: numberreturns the sets underlying canvas element
returns the sets data object
returns the requested formatter
available types are:
returns the requested formatter
available types are:
returns the categorization of the objects options can be used for displaying a more structured user interface
returns the objects current state
return the sets current style object
returns the translator instance used by this chart must not be cached/stored externally because it can change at any time
Automatically toggles the EXPOSED flag on dependent options when a 'parent' option changes value.
For each entry in optionDependencies
, whenever the parent option
emits an optionChanged
event, its dependents (listed in dependentNames
)
will be exposed (flag added) if the new value === exposeWhen
, or
hidden (flag removed) otherwise.
Map where:
exposeWhen
: the boolean that triggers exposing the dependents or a function with the newValue for custom validationdependentNames
: array of dependent option names whose EXPOSED flag will be toggledclass Test extends ChartbreakerObject {
constructor() {
super();
this.registerOptionDependencyVisibility(new Map([
['showLine', { exposeWhen: true, dependentNames: ['lineColor', 'lineStyle'] }],
['advancedMode', { exposeWhen: false, dependentNames: ['simpleModeOnlyOption'] }],
['description'], { exposeWhen: (text) => !!text.length, ['fontSize', 'fontColor']}
]));
}
}
life cycle method; called when the object should start normal operation at this point is is already completely initialized
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
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
request redrawing of all charts
Optional
delay: numberan optional delay in milliseconds
Optional
redrawMode: ERedrawReasonOptional
indices: { from: number; to: number }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
Optional
v: anyOptional
flags: ObjectEFlagsby 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
Optional
objType: stringOptional
objName: stringReturns a string representation of an object.
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
Optional
v: anyOptional
flags: ObjectEFlagswhen 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.
Optional
options: string | string[]Static
guardStatic
listenerStatic
set
The ChartSet serves as a container around multiple individual Chart objects displaying data from the same timespan.
For example, a typical finance chart consists of one chart displaying stock quotes in the form of candlesticks, and and another chart displaying the traded volume. These two charts are linked via their x-axis - if the viewed span is changed in one chart, it also changes in the other.
The ChartSet is responsible for this synchronization by controlling the underlying Data object, basic event handling, the most general aspects of layout such as ordering charts. Visualization of the actual data and further event handling such as interaction with objects is then handled by the individual chart objects themselves.
By default, the chartset is drawn with an opaque background. This can be changed - e.g. to display a logo in the background of the chart via CSS - by clearing the style value 'background-color' or setting it to 'none'.