每当有人点击我的图表或其中一个栏时,我需要触发一个事件,但由于某种原因,事件不会为我触发。
这是我的代码:
<apexchart type="rangeBar" :options="chartOptions" class="ganttChart" :series="series"></apexchart>
Run Code Online (Sandbox Code Playgroud)
我的设置:
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: {
events: {
click: function(event, chartContext, config) {
alert(event, chartContext, config);
}
},
height: 400,
width: 400,
type: 'rangeBar',
},
plotOptions: {
bar: { …Run Code Online (Sandbox Code Playgroud)