Appearance
Extension API
Register and discover ChartSpire extensions. Import these helpers from @chartspire/ui — they are not methods on a ChartSpire instance.
Built-in overlays and indicators are registered automatically when you import @chartspire/ui. After registration, create instances on a chart with the Chart API.
typescript
import {
registerIndicator,
getSupportedIndicators,
getSupportedOverlays,
registerLocale,
getSupportedLocales,
} from '@chartspire/ui'
import type {
IndicatorDefinition,
OverlayTemplate,
LocaleMessages,
} from '@chartspire/ui'Indicators
registerIndicator(indicator)
Register a custom ChartSpire indicator type. Adds it to the main/sub indicator UI lists and registers the calculation template. To add an instance on a chart, use Chart API createIndicator.
typescript
(indicator: IndicatorDefinition) => voidSee Indicators for the full IndicatorDefinition shape, parameter reference, and custom indicator guide.
typescript
import { registerIndicator } from '@chartspire/ui'
import type { IndicatorDefinition } from '@chartspire/ui'
const testIndicator: IndicatorDefinition = {
isMainIndicator: false,
isSubIndicator: true,
parameters: [],
name: 'testIndicator',
shortName: 'testIndicator',
figures: [{
key: 'close',
title: 'close: ',
type: 'line',
}],
calc: (dataList) => dataList.map((data) => ({ close: data.close })),
}
registerIndicator(testIndicator)
// optional programmatic add on a chart
chartspire.getActiveChart()?.createIndicator('testIndicator')getSupportedIndicators()
List indicator names registered with ChartSpire (including main and sub UI lists).
typescript
() => string[]Overlays
Built-in overlays are registered automatically when you import @chartspire/ui. Use getSupportedOverlays() to list them; create instances on a chart with the Chart API.
getSupportedOverlays()
typescript
() => string[]Locales
registerLocale(locale, messages)
Register or merge one flat locale pack for the complete ChartSpire widget, including its UI and chart labels. Missing messages fall back to en-US.
typescript
(locale: string, messages: LocaleMessages) => voidRegister custom locales before creating a widget that uses them. See Internationalization and the Locale Keys catalog.
getSupportedLocales()
typescript
() => string[]Returns locales registered with the complete ChartSpire locale registry. Engine-only locales are not reported.
Related
- Widget API — theme, locale, timezone, multichart
- Chart API — add indicator/overlay instances to a chart
- Indicators — custom indicator guide
- Widget API — constructor options