Kumo Charts

@kumo-charts/vue

The API reference is generated from the source comments.

import { … } from '@kumo-charts/vue';

Functions

useKumoChartfunctionSource

function useKumoChart<const M extends readonly ChartModule[] = readonly []>(
  target: Ref<HTMLElement | null>,
  options?: MaybeRefOrGetter<CreateChartOptions<M> | undefined>
): ShallowRef<Chart<M> | null>

Creates a chart inside target once it is mounted, with the modules of the options as they are then, and destroys it on unmount. The other options and their changes are applied with chart.applyOptions().

const container = useTemplateRef<HTMLDivElement>('container');
const chart = useKumoChart(container, { modules: [indicators(allIndicators)], locale: 'zh-CN' });

Components

KumoChartcomponentSource

const KumoChart = defineComponent({ … })

Vue 3 component around createChart(). modules are read when the chart is created. Props replace the chart's data, orders, markers or alerts whenever their value changes; every event of the chart and its modules is re-emitted (e.g. @crosshair-move, @order-drag), plus @ready with the chart instance. Stream real-time bars with chart.data.update(); manage indicators and drawings through the instance and persist them with chart.saveState().

modules?: readonly ChartModule[]

The chart's modules, such as [indicators(allIndicators)], read when it is created.

options?: ChartOptionsInput & Readonly<Record<string, unknown>>

Applied with chart.applyOptions(), the options of the modules too.

data?: readonly BarInput[]

Replaces all bars when the array or interval changes.

interval?: IntervalInput

Resolution of data, such as '1m'; needed for timeframe and chart.data.addTrades().

timeframe?: IntervalInput | null

The displayed timeframe, such as '15m'; null shows the source resolution.

transform?: BarTransformInput | null

Builds the displayed bars, e.g. { type: 'renko' }; null shows the timeframe's bars.

orders?: readonly OrderInput[]

Needs the orders module.

markers?: readonly MarkerInput[]

Needs the markers module.

alerts?: readonly AlertInput[]

Needs the alerts module.

Types

KumoChartEventMaptypeSource

type KumoChartEventMap = AllEventMap

The events of the chart and of its modules; those of a module the chart lacks never fire.

KumoChartEventNametypeSource

type KumoChartEventName = keyof KumoChartEventMap

The name of an event of the chart or of one of its modules.

KumoChartPropstypeSource

type KumoChartProps = ExtractPublicPropTypes<typeof kumoChartProps>

What KumoChart takes as props, for typing a wrapper or a props object.

↑↓ to select · Enter to open · Esc to close