小编Nor*_*ora的帖子

点击事件不适用于 ApexCharts (Vue3)

每当有人点击我的图表或其中一个栏时,我需要触发一个事件,但由于某种原因,事件不会为我触发。

这是我的代码:

<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)

vue.js apexcharts vuejs3

10
推荐指数
1
解决办法
3647
查看次数

标签 统计

apexcharts ×1

vue.js ×1

vuejs3 ×1