Vue
vue-apexstock is a thin, typed Vue 3 component around the imperative ApexStock class. It creates the instance on mount, forwards prop changes to update(), and tears it down on unmount.
Installation
npm install vue-apexstock apexstock apexcharts
apexcharts, apexstock, and vue (3.3 or newer) are peer dependencies. The wrapper requires apexstock >=0.5.0 <1 and apexcharts ^7.1.0 || ^8.0.0, and those two have to agree: apexstock 0.5.0 and later pair with ApexCharts 7.1 and later, so an older apexstock alongside apexcharts@7 will not resolve. ApexCharts 8 needs apexstock 0.5.2 and vue-apexstock 0.2.3 or newer: apexstock 0.5.0 and 0.5.1 and vue-apexstock 0.2.2 accept ^7.1.0 only. vue-apexstock 0.2.3 takes the current apexstock 0.6.0 as it is.
To follow an Ignite UI theme, import the core's add-on once in the app, import 'apexstock/ignite-ui', not anything from the wrapper. It needs ApexCharts 8.8.0 or later. See Using with Ignite UI.
ApexCharts can reach the library three ways. Pass it to the component with the apexCharts prop, register it once app-wide with ApexStock.setApexCharts(ApexCharts), or leave it on window.ApexCharts as the core library expects. Under a bundler, prefer one of the first two.
Usage
<script setup>
import { ref } from 'vue'
import ApexStock from 'vue-apexstock'
const options = { chart: { height: 420 }, theme: { mode: 'light' } }
// A new array identity on data change triggers an update.
const series = ref([{ name: 'Price', data: [] }])
</script>
<template>
<ApexStock :options="options" :series="series" style="width: 100%" />
</template>
OHLC points use the ApexStock shape { x, y: [open, high, low, close], v }, see Data Format.
Props
| Prop | Type | Description |
|---|---|---|
options | StockChartOptions | Full chart options (the 2nd argument to new ApexStock). Required. |
series | StockChartOptions["series"] | Convenience: overrides options.series. |
Updates fire when the
optionsorseriesidentity changes (assign a new object/array). In-place mutation of the same object is intentionally not deep-watched, to avoid the cost of deep-watching large datasets.
Accessing the instance
Put a ref on the component. getInstance() returns the live ApexStock instance (call any method) or null before mount; getElement() returns the container <div>.
<script setup>
import { ref } from 'vue'
import ApexStock from 'vue-apexstock'
const chart = ref()
const addRSI = () => chart.value?.getInstance()?.updateIndicator('rsi')
</script>
<template>
<button @click="addRSI">Add RSI</button>
<ApexStock ref="chart" :options="{ chart: { height: 400 }, series }" />
</template>
Through the instance you can reach the full core API: indicators, trading overlays, streaming, theme switching, and export.
Server-side rendering
The component renders only a container <div> on the server; the chart is created in a client-only onMounted hook. The core apexstock package is import-safe in Node, but rendering needs a DOM.
Licensing
Register your license key once, before charts render, with the core class. See Installation & Usage.