Installation
npm install apexcharts vue3-apexcharts
apexChart.vue
<template>
<ApexChart
type="area"
height="350"
:series="basicChartSeries"
:options="basicChart"
/>
</template>
<script setup>
import VueApexCharts from 'vue3-apexcharts'
// Register component
const ApexChart = VueApexCharts
// Define your color
const primaryColor = '#7366FF'
// Sample data (replace with your own)
const seriesData = {
monthDataSeries1: {
prices: [8107.85, 8128.0, 8122.9, 8165.5, 8340.7, 8423.7, 8423.5],
dates: [
'2023-01-01',
'2023-02-01',
'2023-03-01',
'2023-04-01',
'2023-05-01',
'2023-06-01',
'2023-07-01'
]
}
}
const basicChartSeries = [
{
name: 'STOCK ABC',
data: seriesData.monthDataSeries1.prices
}
]
const basicChart = {
chart: {
type: 'area',
zoom: {
enabled: false
},
toolbar: {
show: false
}
},
dataLabels: {
enabled: false
},
stroke: {
curve: 'straight'
},
title: {
text: 'Fundamental Analysis of Stocks',
align: 'left'
},
subtitle: {
text: 'Price Movements',
align: 'left'
},
labels: seriesData.monthDataSeries1.dates,
xaxis: {
type: 'datetime'
},
yaxis: {
opposite: true
},
legend: {
horizontalAlign: 'left'
},
colors: [primaryColor]
}
</script>
apexChart.component.ts
import { Component } from '@vueuse/core';
import { NgApexchartsModule } from 'vue3-apexcharts';
import {
ApexNonAxisChartSeries,
ApexPlotOptions,
ApexChart,
ApexLegend,
ApexResponsive,
ApexStroke
} from "vue3-apexcharts";
export type chartOptions = {
series: ApexNonAxisChartSeries;
chart: ApexChart;
labels: any;
colors: any;
legend: ApexLegend;
plotOptions: ApexPlotOptions;
responsive: ApexResponsive | ApexResponsive[];
stroke: ApexStroke
};
@Component({
selector: 'app-apex-chart',
imports:[NgApexchartsModule],
templateUrl: './apex-chart.component.html',
styleUrl: './apex-chart.component.scss'
})
export class ApexChartComponent {
public basicAreaChart: chartOptions = {
chart: {
height: 350,
type: 'area',
zoom: {
enabled: false
},
toolbar:{
show: false
}
},
dataLabels: {
enabled: false
},
stroke: {
curve: 'straight'
},
series: [{
name: "STOCK ABC",
data: series.monthDataSeries1.prices
}],
title: {
text: 'Fundamental Analysis of Stocks',
align: 'left'
},
subtitle: {
text: 'Price Movements',
align: 'left'
},
labels: series.monthDataSeries1.dates,
xaxis: {
type: 'datetime',
},
yaxis: {
opposite: true
},
legend: {
horizontalAlign: 'left'
},
colors:[ primary ]
};
}
Uninstalling Package
npm uninstall apexcharts vue3-apexcharts