# Methods reference

> WestCoast Charts 1.1.5, release, public Core release, on npm. HTML: https://westcoast-charts.com/docs/reference/methods/ · Index for agents: https://westcoast-charts.com/llms.txt · Source: library guide, commit 95f093ba

Methods of the chart class, as declared in the type definitions. `WestCoastCharts` and `ApexCharts`
are the same class, so every method is available under both names.

## Instance methods

| Method | Signature | Description |
| --- | --- | --- |
| `new WestCoastCharts` | <code>new WestCoastCharts(el: any, options: any)</code> | Creates a chart for the element (or selector result) `el` with the given options; nothing is drawn until `render()`. |
| `render` | <code>render(): Promise&lt;void&gt;</code> | Draws the chart into its element; resolves when the first render is done. A chart with `chart.id` is registered for `getChartByID` and `exec`. |
| `updateOptions` | <code>updateOptions( options: any, redrawPaths?: boolean, animate?: boolean, updateSyncedCharts?: boolean ): Promise&lt;void&gt;</code> | Merges `options` into the current config and redraws. `redrawPaths` (default `false`) redraws from scratch instead of morphing; `animate` (default `true`); `updateSyncedCharts` (default `true`) applies the change to charts in the same `chart.group`. An update identical to the previous one is skipped. |
| `updateSeries` | <code>updateSeries( newSeries: ApexAxisChartSeries \| ApexNonAxisChartSeries \| WccSeries[], animate?: boolean ): Promise&lt;void&gt;</code> | Replaces all series and redraws; `animate` defaults to `true`. Series are normalised for the chart type first. |
| `appendSeries` | <code>appendSeries( newSeries: ApexAxisChartSeries \| ApexNonAxisChartSeries \| WccSeries[], animate?: boolean ): Promise&lt;void&gt;</code> | Adds one series after the existing ones and redraws; `animate` defaults to `true`. |
| `appendData` | <code>appendData(data: any[], overwriteInitialSeries?: boolean): void</code> | Appends points: `data[i].data` is added to the end of series `i`; entries that are `null` or missing leave that series unchanged. `overwriteInitialSeries` (default `true`) also stores the result as the initial series used by reset. |
| `toggleSeries` | <code>toggleSeries(seriesName: string): any</code> | Hides the named series if visible, shows it if hidden, as a legend click does. |
| `isSeriesHidden` | <code>isSeriesHidden(seriesName: string): boolean</code> | `true` when the named series is hidden (legend or `hideSeries`); `false` when visible or unknown. |
| `highlightSeries` | <code>highlightSeries(seriesName: string): any</code> | Emphasises the named series and dims the others, as hovering its legend item does. |
| `showSeries` | <code>showSeries(seriesName: string): void</code> | Shows the named series if it is hidden. |
| `hideSeries` | <code>hideSeries(seriesName: string): void</code> | Hides the named series. |
| `resetSeries` | <code>resetSeries(shouldUpdateChart?: boolean, shouldResetZoom?: boolean): void</code> | Restores the initial series and shows hidden series. `shouldUpdateChart` (default `true`) redraws; `shouldResetZoom` (default `true`) also resets the zoom of that redraw. |
| `zoomX` | <code>zoomX(min: number, max: number): void</code> | Zooms the x axis to `min`..`max` (timestamps on datetime axes). |
| `toggleDataPointSelection` | <code>toggleDataPointSelection(seriesIndex: number, dataPointIndex?: number): any</code> | Selects or deselects a data point as a click does; pie-like charts take the slice index as `seriesIndex`. Returns the element, or `null` with a warning when it is not found. |
| `destroy` | <code>destroy(): void</code> | Removes the chart, its listeners and its feature state from the page. |
| `setLocale` | <code>setLocale(localeName: string): void</code> | Switches to a locale from `chart.locales` (or the global `Apex.chart.locales`); throws when the name is not found. Text drawn already changes on the next update. |
| `paper` | <code>paper(): void</code> | Returns the internal SVG drawing surface of the chart (for low-level drawing). |
| `addXaxisAnnotation` | <code>addXaxisAnnotation(options: any, pushToMemory?: boolean, context?: any): void</code> | Adds an x-axis annotation (same fields as `annotations.xaxis[]`). `pushToMemory` (default `true`) keeps it across redraws. |
| `addYaxisAnnotation` | <code>addYaxisAnnotation(options: any, pushToMemory?: boolean, context?: any): void</code> | Adds a y-axis annotation (same fields as `annotations.yaxis[]`). `pushToMemory` (default `true`) keeps it across redraws. |
| `addPointAnnotation` | <code>addPointAnnotation(options: any, pushToMemory?: boolean, context?: any): void</code> | Adds a point annotation (same fields as `annotations.points[]`). `pushToMemory` (default `true`) keeps it across redraws. |
| `removeAnnotation` | <code>removeAnnotation(id: string, options?: any): void</code> | Removes the annotation with this `id`. |
| `clearAnnotations` | <code>clearAnnotations(options?: any): void</code> | Removes the drawn annotations and forgets those added through the add*Annotation methods. |
| `dataURI` | <code>dataURI(options?: { scale?: number, width?: number }): Promise&lt;{ imgURI: string } \| { blob: Blob }&gt;</code> | Renders the chart to a PNG and resolves `{ imgURI }` (a data URL). `scale` multiplies the size; `width` sets the pixel width instead. Rejects under a Content-Security-Policy without `blob:`/`data:` image sources. |
| `refreshTokens` | <code>refreshTokens(): Promise&lt;void&gt;</code> | Re-reads the CSS design tokens (`--wcc-*`) after a CSS change and re-themes the chart without animation. |
| `exports` | <code>exports: { cleanup(): string svgUrl(): string dataURI(options?: { scale?: number, width?: number }): Promise&lt;{ imgURI: string } \| { blob: Blob }&gt; exportToSVG(): void exportToPng(): void exportToCSV(options?: { series?: any, fileName?: string, columnDelimiter?: string, lineDelimiter?: string }): void getSvgString(scale?: number): void triggerDownload(href: string, filename?: string, ext?: string): void }</code> | Export helpers used by the toolbar menu (SVG, PNG, CSV and the image data URL). |

## Static methods

| Method | Signature | Description |
| --- | --- | --- |
| `exec` | <code>exec(chartID: string, fn: string, ...args: Array&lt;any&gt;): any</code> | Calls the public method `fn` with `args` on the chart registered under `chartID`; returns its result, or nothing when the chart or method is unknown. |
| `getChartByID` | <code>getChartByID(chartID: string): ApexCharts \| undefined</code> | The rendered chart whose `chart.id` is `chartID`, or `undefined`. |
| `escapeHtml` | <code>escapeHtml(value: any): string</code> | West Coast Charts: escape a value for use inside formatter / tooltip.custom HTML |
| `sanitizeHtml` | <code>sanitizeHtml(html: string): string</code> | West Coast Charts: run markup through the built-in sanitizer |
| `themePresets` | <code>themePresets: string[]</code> | West Coast Charts: names of the built-in theme presets |
| `merge` | <code>merge&lt;T = any, S = any&gt;(target: T, source: S): T & S</code> | deep-merge `source` into a copy of `target` the way chart options are merged (arrays are replaced, plain objects merged) and return the result |
| `registerEasing` | <code>registerEasing( name: string, fn: ((t: number) =&gt; number) \| [number, number, number, number] ): boolean</code> | West Coast Charts: register a named easing for chart.animations.easing: a function of t (0..1) or cubic-bezier control points. Returns false when the name or curve is invalid. |
| `registerTheme` | <code>registerTheme( name: string, def: { palette?: string[] mode?: 'light' \| 'dark' preset?: string tokens?: WccThemeTokens & { accent?: string fore?: string series?: string[] } } ): boolean</code> | Registers a named theme for `theme.name`: a palette, mode, base preset and design tokens. Returns `true` when registered. |
| `unregisterTheme` | <code>unregisterTheme(name: string): boolean</code> | Removes a theme registered with `registerTheme`; returns the result of the removal. |
| `getThemeTokens` | <code>getThemeTokens( preset?: string, mode?: 'light' \| 'dark', overrides?: WccThemeTokens ): WccThemeTokens</code> | West Coast Charts: resolved design tokens of a preset in a mode, with optional overrides |
| `initOnLoad` | <code>initOnLoad(): void</code> | Renders a chart into every element with a `data-apexcharts` attribute, using the JSON in its `data-options` attribute. |
| `crossfilter` | <code>crossfilter?: (opts: { id?: string \| number; records?: any[]; key?: string; [key: string]: any }) =&gt; any</code> | link feature: creates the crossfilter record set shared by the charts whose `chart.link.id` (or `chart.group`) equals `opts.id`; called again with the same id it replaces the records. `key` names the record id field. |
| `getCrossfilter` | <code>getCrossfilter?: (id: string \| number) =&gt; any</code> | link feature: the crossfilter record set with that id, or `null` |
| `perspectives` | <code>perspectives?: { fromURL(url?: string): any }</code> | perspectives feature: read a perspective encoded in a URL (default location.href) |
| `validate` | <code>validate?: (options: ApexCharts.ApexOptions \| any, opts?: { premium?: boolean; maxIssues?: number }) =&gt; { ok: boolean errors: number warnings: number exitCode: number schemaVersion: string issues: { kind: string; severity: 'error' \| 'warning'; path: string; pointer: string; message: string; hint: string \| null; suggestion: any; alternatives: any[]; fix: any; exitCode: number }[] }</code> | validator module (west-coast-charts/agent/validate): structured option issues, docs/errors.md |
| `applyFixes` | <code>applyFixes?: &lt;T = any&gt;(options: T, issues: any[]) =&gt; T</code> | validator module: a copy of the options with the issues' fixes applied |
| `validateMode` | <code>validateMode?: 'warn' \| 'error' \| 'off'</code> | validator module: default of chart.validate. Default: `'warn'`. |
| `registerMap` | <code>registerMap(name: string, data: object): boolean</code> | West Coast Charts: register TopoJSON / GeoJSON for chart.type 'map' (west-coast-charts/premium) |
| `getMapMetadata` | <code>getMapMetadata?: (source: string \| object, objectName?: string \| null) =&gt; { name: string; ids: string[]; keys: string[] } \| null</code> | Premium map registry metadata for validation; null when no map is registered. |
| `setLicenseKey` | <code>setLicenseKey?: (key: string) =&gt; Promise&lt;ApexCharts.WestCoastChartsLicense \| null&gt;</code> | West Coast Charts premium (present once west-coast-charts/premium is installed): the licence key for every premium chart without its own chart.licenseKey. Checked offline; resolves to the payload or null. Without a valid key premium charts still render in full, with a small watermark (never on localhost, 127.0.0.1, *.local). docs/spec/06-premium-types.md §10. |
| `headless` | <code>headless: boolean</code> | Headless mode (CLI, MCP, snapshot jobs): every chart renders deterministically (`chart.deterministic`) unless it sets `deterministic: false`. Same as `globalThis.WCC_HEADLESS = true`. Default: `false`. |
| `use` | <code>use( plugin: \| ApexCharts.WestCoastChartsPlugin \| ReadonlyArray&lt;ApexCharts.WestCoastChartsPlugin&gt; \| { readonly [key: string]: ApexCharts.WestCoastChartsPlugin } ): typeof ApexCharts</code> | West Coast Charts: install a plugin, an array of plugins or an object of plugins: `WestCoastCharts.use(types)` from 'west-coast-charts/types', premium, features. Idempotent per plugin and plugin name. |

## Methods added by features

Present once the feature is installed (`west-coast-charts/features/<name>` or `west-coast-charts/full`), so they
are optional in the typings: check before calling, e.g. `chart.history && chart.history.undo()`.

| Member | Signature | Description |
| --- | --- | --- |
| `drillDown` | <code>drillDown?(id: string \| number): Promise&lt;any&gt;</code> | drilldown: open the level with this drilldown.series id |
| `drillUp` | <code>drillUp?(): Promise&lt;any&gt;</code> | drilldown: back one level |
| `drillToRoot` | <code>drillToRoot?(): Promise&lt;any&gt;</code> | drilldown: back to the top level |
| `clearDrilldownCache` | <code>clearDrilldownCache?(id?: string): void</code> | drilldown: forget loaded levels (one id, or all) |
| `clearCrossfilter` | <code>clearCrossfilter?(): void</code> | link: clear this chart's crossfilter selection |
| `describe` | <code>describe?(opts?: { format?: 'json'; maxRows?: number }): WccDescribeResult</code> | agent/describe ('west-coast-charts/agent/describe'): what the chart drew, from the same code as the accessible description and data table. `'json'` (default): WccDescribeResult (dist/schema/wcc-describe.schema.json); `'table'`: the data table; `'markdown'`: a string. |
| `describe` | <code>describe?(opts: { format: 'table'; maxRows?: number }): WccDescribeTable</code> |  |
| `describe` | <code>describe?(opts: { format: 'markdown'; maxRows?: number }): string</code> |  |
| `promotePanel` | <code>promotePanel?(key: any): Promise&lt;any&gt;</code> | trellis: show one panel at full size (null when there is no such panel) |
| `restorePanels` | <code>restorePanels?(): Promise&lt;any&gt;</code> | trellis: back to the grid |
| `restorePanel` | <code>restorePanel?(): Promise&lt;any&gt;</code> | trellis: alias of restorePanels |
| `getPromotedPanel` | <code>getPromotedPanel?(): any</code> | trellis: key of the promoted panel, or null |
| `getPanels` | <code>getPanels?(): any[]</code> | trellis: the panels in display order |
| `getPanel` | <code>getPanel?(key: any): any</code> | trellis: one panel by key |
| `highlightFilter` | <code>object</code> | highlight-filter feature |
| `highlightFilter.set()` | <code>set(rows: any, opts?: any): Promise&lt;any&gt;</code> | Sets the parts: an array per series, or a function `(seriesIndex, dataPointIndex, seriesName, x, value, datum, w)` returning the part of each point; `null` clears. `opts.series` limits it to some series; `opts.animate: false` skips the animation. |
| `highlightFilter.clear()` | <code>clear(opts?: any): Promise&lt;any&gt;</code> | Removes all parts and redraws the wholes. |
| `highlightFilter.valueAt()` | <code>valueAt(seriesIndex: number, dataPointIndex: number): number \| null \| undefined</code> | The part of a point: a number, `null` (point without part) or `undefined` (no parts). |
| `highlightFilter.isActive()` | <code>isActive(): boolean</code> | `true` when the feature is enabled, the chart type is supported and at least one part is set. |
| `perspectives` | <code>object</code> | perspectives feature: saved views |
| `perspectives.capture()` | <code>capture(opts?: any): any</code> | The current view state as plain JSON; `opts.only` limits it to some slices. |
| `perspectives.apply()` | <code>apply(perspective: any, opts?: any): Promise&lt;any&gt;</code> | Brings the chart to a state, a token or a saved name; resolves `{ state }` when landed, or `{ superseded: true }` when a newer apply started. `opts.animate: false` jumps. |
| `perspectives.toURL()` | <code>toURL(perspective?: any, base?: string): string</code> | URL with `#wcc=&lt;token&gt;` for a state (default: the current one); `base` defaults to the page URL. |
| `perspectives.encode()` | <code>encode(perspective: any): string</code> | Compact URL-safe token of a state (default: the current one). |
| `perspectives.decode()` | <code>decode(text: string): any</code> | The state of a token. |
| `perspectives.save()` | <code>save(name: string, perspective?: any): any</code> | Saves a state (default: the current one) under a name, in localStorage per chart id; returns the state. |
| `perspectives.list()` | <code>list(): any[]</code> | Saved perspectives, oldest first: `[{ name, at, state }]`. |
| `perspectives.load()` | <code>load(name: string, opts?: any): Promise&lt;any&gt;</code> | Applies a saved perspective (same result as `apply`). |
| `perspectives.delete()` | <code>delete(name: string): boolean</code> | Deletes a saved perspective; `false` when there was none. |
| `storyboard` | <code>object</code> | storyboard feature |
| `storyboard.bind()` | <code>bind(config?: { [key: string]: any }): any</code> | Binds scroll beats `{ beats: [{ selector \| element, view?, options?, key? }], wcc: { offset, scrub, nav, initial, describe } }`, replacing an earlier binding; resolves when the initial beat has landed. |
| `storyboard.goTo()` | <code>goTo(step: number, opts?: any): Promise&lt;any&gt;</code> | Goes to beat `step`; resolves `{ index }` when landed or `{ superseded: true }`. |
| `storyboard.current()` | <code>current(): any</code> | The current beat `{ index, key, element }`, or `null`. |
| `storyboard.unbind()` | <code>unbind(): void</code> | Stops observing the beats. |
| `history` | <code>object</code> | history feature |
| `history.undo()` | <code>undo(): Promise&lt;{ index: number }&gt;</code> | Reverts the last applied entry; resolves with the new index. |
| `history.redo()` | <code>redo(): Promise&lt;{ index: number }&gt;</code> | Re-applies the next entry; resolves with the new index. |
| `history.canUndo()` | <code>canUndo(): boolean</code> | `true` when an entry can be undone. |
| `history.canRedo()` | <code>canRedo(): boolean</code> | `true` when an undone entry can be redone. |
| `history.jump()` | <code>jump(index: number): Promise&lt;{ index: number }&gt;</code> | Moves to `index` applied entries (0 = everything undone). |
| `history.clear()` | <code>clear(): void</code> | Forgets all entries; the current view becomes the starting point. |
| `history.entries()` | <code>entries(): any[]</code> | Copies of the entries: `{ id, label, kind, at, before, after, applied, chartId }`. |
| `history.transaction()` | <code>transaction&lt;T&gt;(label: string, fn: () =&gt; T \| Promise&lt;T&gt;): Promise&lt;T&gt;</code> | one undo entry for everything fn changes |
| `history.index` | <code>readonly index: number</code> | Number of entries currently applied (0 = everything undone). |
| `history.size` | <code>readonly size: number</code> | Number of entries. |
| `orient` | <code>object</code> | orient feature ("Ansicht ausrichten"): turning radial charts |
| `orient.rotateBy()` | <code>rotateBy(by: number \| { steps: number }, opts?: { animate?: boolean; snap?: boolean; announce?: boolean }): Promise&lt;WccOrientState&gt;</code> | Turns by degrees (snapped to whole segments) or `{ steps }` (time windows, see `chart.orient.step`); positive = clockwise. |
| `orient.rotateTo()` | <code>rotateTo(segment: number \| string \| Date \| { segment: number \| string }, position?: 'top' \| 'right' \| 'bottom' \| 'left' \| number, opts?: { animate?: boolean; align?: 'start' \| 'center' \| 'end'; announce?: boolean }): Promise&lt;WccOrientState & { missed?: boolean }&gt;</code> | Turns a segment to a position: an index, a category or layer segment name, a time `'HH:MM'` / `Date` (its window on a clock ring). Times align their window start, goal arcs their end, anything else its middle (`opts.align`). |
| `orient.set()` | <code>set(degrees: number, opts?: { animate?: boolean; announce?: boolean }): Promise&lt;WccOrientState&gt;</code> | Turns to an absolute angle (the short way round). |
| `orient.reset()` | <code>reset(opts?: { animate?: boolean; announce?: boolean }): Promise&lt;WccOrientState&gt;</code> | Back to the default orientation. |
| `orient.get()` | <code>get(): WccOrientState</code> | The current turn. |
| `orient.segmentAt()` | <code>segmentAt(position?: 'top' \| 'right' \| 'bottom' \| 'left' \| number): string \| null</code> | Name of the segment at a position (default `'top'`), or `null`. |
| `orient.describe()` | <code>describe(): string</code> | The sentence `describe()` and the accessible description add while the chart is turned; `''` otherwise. |
| `wcc` | <code>object</code> | narrative feature (wcc.narrative) and other per-chart West Coast Charts runtimes |
| `wcc.narrative` | <code>object</code> | narrative feature: player of the wcc.narrative frames |
| `wcc.narrative.play()` | <code>play(): Promise&lt;void&gt;</code> | Starts playback (from the start when at the last frame of a frames source). |
| `wcc.narrative.pause()` | <code>pause(): void</code> | Stops playback. |
| `wcc.narrative.seek()` | <code>seek(target: number \| { t: any }, opts?: { animate?: boolean; [key: string]: any }): Promise&lt;any&gt;</code> | Goes to frame `target` (fractional = interpolated) or to `{ t }`. |
| `wcc.narrative.step()` | <code>step(d: number): Promise&lt;any&gt;</code> | Pauses and moves one frame back (`d &lt; 0`) or forward. |
| `wcc.narrative.live()` | <code>live(): Promise&lt;any&gt;</code> | Record source: back to the newest data. |
| `wcc.narrative.frames()` | <code>frames(): any[]</code> | Copies of the frames `{ t, series, label?, caption? }`. |
| `wcc.narrative.current()` | <code>current(): any</code> | `{ index, position, t, label, playing, live }` of the frame shown, or `null`. |
| `wcc.narrative.record()` | <code>record(on?: boolean): boolean</code> | Record source: pauses (`false`) or resumes recording; returns the new state. |
| `wcc.narrative.clear()` | <code>clear(): void</code> | Removes the frames (record source: keeps the current data as the first frame). |
| `wcc.narrative.setSpeed()` | <code>setSpeed(speed: number): void</code> | Playback speed: `0.5`, `1` or `2` (other values use `1`). |
