ApexCharts events not working with vue3
See original GitHub issueI’ve been trying to fire an event whenever someone clicks somewhere on the chart but I’ve been unable to do it with a vue3 project setup. My charts are showing fine but firing events does not work.
I’ve used the following code:
<apexchart type="rangeBar" width="500px" :options="chartOptions" :series="series"></apexchart>
setup() {
const series = [
{
name: 'Sunny',
data: [
{
x: 'Weather',
y: [
new Date('2019-03-05').getTime(),
new Date('2019-03-08').getTime()
]
},
]
},
{
name: 'Rainy',
data: [
{
x: 'Weather',
y: [
new Date('2019-03-02').getTime(),
new Date('2019-03-05').getTime()
]
},
]
}
];
const chartOptions = {
chart: {
height: 800,
width: 800,
type: 'rangeBar',
events: {
click(event, chartContext, config) {
alert(event, chartContext, config);
}
},
},
plotOptions: {
bar: {
horizontal: true
}
},
fill: {
type: 'gradient',
gradient: {
shade: 'light',
type: 'vertical',
shadeIntensity: 0.25,
gradientToColors: undefined,
inverseColors: true,
opacityFrom: 1,
opacityTo: 1,
stops: [50, 0, 100, 100]
}
},
xaxis: {
type: 'datetime'
},
title: {
text: "Scene Viewer",
align: "center",
style: {
fontSize: "15px"
}
},
legend: {
position: 'top'
}
};
const options = {
chart: {
id: 'vuechart-example',
events: {
click(event, chartContext, config) {
alert(event, chartContext, config);
console.log("wqewqeqeqweq")
alert("qwewqeqeqe")
}
},
},
xaxis: {
categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998]
}
}
}
Is anyone else having issues with events? Am I missing a piece of configuration? Any help would be greatly appreciated.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:8
Top Results From Across the Web
Click event not working with ApexCharts (Vue3) - Stack Overflow
Apart from the events, my chart shows and works just fine. vue.js · vuejs3 · apexcharts · Share.
Read more >ApexCharts events not working with vue3 - Vue Forum
I've been trying to fire an event whenever someone clicks somewhere on the chart but I've been unable to do it with a...
Read more >How To Use Events on vue3-apexcharts - Jangwook Kim
If you are stuck to use events on vue3-apexcharts, this article is useful to you. ... [TroubleShooting] How to rollback a dropped stash?...
Read more >[Solved]-Click event not working with ApexCharts (Vue3)-Vue.js
Coding example for the question Click event not working with ApexCharts (Vue3)-Vue.js.
Read more >A Vue Chart wrapper for ApexCharts.js
import VueApexCharts from "vue3-apexcharts"; const app = createApp(App); app.use(VueApexCharts); // The app.use(VueApexCharts) will make <apexchart> component ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ajkaeser
Here are all emits https://github.com/apexcharts/vue3-apexcharts/blob/main/src/vue3-apexcharts.js
It is a wrapper to original ApexCharts events !
there is no actual info about events in docs, but you should subscribe on events on component like
<apex-chart :options="options" :series="series" @markerClick="handleClick"
/>