Documentation / @ripl/charts / Chart
Class: Chart<TOptions, TEventMap> ​
Defined in: charts/src/core/chart.ts:64
Abstract base class for all chart types, providing scene, renderer, animation, color management, and lifecycle.
Extends ​
EventBus<TEventMap>
Extended by ​
AreaChartBarChartChordChartFunnelChartGanttChartGaugeChartHeatmapChartLineChartPieChartPolarAreaChartRadarChartSankeyChartScatterChartStockChartSunburstChartTreemapChartRealtimeChartTrendChart
Type Parameters ​
| Type Parameter | Default type |
|---|---|
TOptions extends BaseChartOptions | - |
TEventMap extends EventMap | EventMap |
Constructors ​
Constructor ​
new Chart<
TOptions,TEventMap>(target,options?):Chart<TOptions,TEventMap>
Defined in: charts/src/core/chart.ts:81
Parameters ​
| Parameter | Type |
|---|---|
target | string | Context<Element, Record<string, unknown>> | HTMLElement |
options? | TOptions |
Returns ​
Chart<TOptions, TEventMap>
Overrides ​
Properties ​
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
animationOptions | protected | ChartAnimationOptions | - | charts/src/core/chart.ts:72 |
autoRender | protected | boolean | - | charts/src/core/chart.ts:71 |
colorGenerator | protected | Generator<string, string, any> | - | charts/src/core/chart.ts:78 |
options | protected | TOptions | - | charts/src/core/chart.ts:77 |
parent? | public | EventBus<TEventMap> | EventBus.parent | core/src/core/event-bus.ts:79 |
renderer | protected | Renderer | - | charts/src/core/chart.ts:70 |
scene | protected | Scene | - | charts/src/core/chart.ts:69 |
titleOptions? | protected | ChartTitleOptions | - | charts/src/core/chart.ts:73 |
defaultKey | readonly | typeof defaultKey | EventBus.defaultKey | core/src/core/disposer.ts:10 |
Methods ​
destroy() ​
destroy():
void
Defined in: charts/src/core/chart.ts:195
Destroys the chart, its scene, context, and cleans up all event subscriptions.
Returns ​
void
Overrides ​
dispose() ​
protecteddispose(key?):void
Defined in: core/src/core/disposer.ts:24
Disposes all resources under the given key, or all resources if no key is provided.
Parameters ​
| Parameter | Type |
|---|---|
key? | PropertyKey |
Returns ​
void
Inherited from ​
emit() ​
Call Signature ​
emit<
TEvent>(event):TEvent
Defined in: core/src/core/event-bus.ts:127
Emits an event, invoking all matching handlers and bubbling to the parent if applicable.
Type Parameters ​
| Type Parameter | Default type |
|---|---|
TEvent extends Event<undefined> | Event<undefined> |
Parameters ​
| Parameter | Type |
|---|---|
event | TEvent |
Returns ​
TEvent
Inherited from ​
Call Signature ​
emit<
TEvent>(type,data):Event<TEventMap[TEvent]>
Defined in: core/src/core/event-bus.ts:128
Emits an event, invoking all matching handlers and bubbling to the parent if applicable.
Type Parameters ​
| Type Parameter |
|---|
TEvent extends string | number | symbol |
Parameters ​
| Parameter | Type |
|---|---|
type | TEvent |
data | TEventMap[TEvent] |
Returns ​
Event<TEventMap[TEvent]>
Inherited from ​
getAnimationDuration() ​
protectedgetAnimationDuration(referenceDuration?):number
Defined in: charts/src/core/chart.ts:132
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
referenceDuration | number | 1000 |
Returns ​
number
getChartArea() ​
protectedgetChartArea():ChartArea
Defined in: charts/src/core/chart.ts:163
Returns ​
getPadding() ​
protectedgetPadding():ChartPadding
Defined in: charts/src/core/chart.ts:153
Returns ​
getSeriesColor() ​
protectedgetSeriesColor(seriesId):string
Defined in: charts/src/core/chart.ts:190
Parameters ​
| Parameter | Type |
|---|---|
seriesId | string |
Returns ​
string
has() ​
has(
type):boolean
Defined in: core/src/core/event-bus.ts:84
Returns whether there are any listeners registered for the given event type.
Parameters ​
| Parameter | Type |
|---|---|
type | keyof TEventMap |
Returns ​
boolean
Inherited from ​
init() ​
protectedinit():void
Defined in: charts/src/core/chart.ts:100
Returns ​
void
off() ​
off<
TEvent>(type,handler):void
Defined in: core/src/core/event-bus.ts:102
Removes a previously registered handler for the given event type.
Type Parameters ​
| Type Parameter |
|---|
TEvent extends string | number | symbol |
Parameters ​
| Parameter | Type |
|---|---|
type | TEvent |
handler | EventHandler<TEventMap[TEvent]> |
Returns ​
void
Inherited from ​
on() ​
on<
TEvent>(type,handler,options?):Disposable
Defined in: core/src/core/event-bus.ts:89
Subscribes a handler to the given event type and returns a disposable for cleanup.
Type Parameters ​
| Type Parameter |
|---|
TEvent extends string | number | symbol |
Parameters ​
| Parameter | Type |
|---|---|
type | TEvent |
handler | EventHandler<TEventMap[TEvent]> |
options? | EventSubscriptionOptions |
Returns ​
Inherited from ​
once() ​
once<
TEvent>(type,handler,options?):Disposable
Defined in: core/src/core/event-bus.ts:117
Subscribes a handler that is automatically removed after it fires once.
Type Parameters ​
| Type Parameter |
|---|
TEvent extends string | number | symbol |
Parameters ​
| Parameter | Type |
|---|---|
type | TEvent |
handler | EventHandler<TEventMap[TEvent]> |
options? | EventSubscriptionOptions |
Returns ​
Inherited from ​
render() ​
render(
callback?):Promise<void>
Defined in: charts/src/core/chart.ts:142
Parameters ​
| Parameter | Type |
|---|---|
callback? | (scene, renderer) => Promise<any> |
Returns ​
Promise<void>
resolveSeriesColors() ​
protectedresolveSeriesColors(series):void
Defined in: charts/src/core/chart.ts:175
Parameters ​
| Parameter | Type |
|---|---|
series | object[] |
Returns ​
void
retain() ​
protectedretain(value,key?):void
Defined in: core/src/core/disposer.ts:13
Registers a disposable resource under an optional key for later cleanup.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
value | Disposable | undefined |
key | PropertyKey | Disposer.defaultKey |
Returns ​
void
Inherited from ​
update() ​
update(
options):void
Defined in: charts/src/core/chart.ts:113
Merges partial options into the current options and re-renders if autoRender is enabled.
Parameters ​
| Parameter | Type |
|---|---|
options | Partial<TOptions> |
Returns ​
void