Vue-apexcharts工具栏:选择工具不起作用

问题描述 投票:0回答:1

我创建了带有vue apexcharts的折线图,并试图在工具栏中启用选择工具(如此处的解释:https://apexcharts.com/docs/options/chart/toolbar/]

但是即使我设置了:

selection: true,

它没有出现在图表上。

这是我的Vue组件:

<template>
  <div class="container">
    <apexchart :type="typechart" height="350" :options="options" :series="series"></apexchart>
  </div>
</template>

<script lang="ts">
import { Vue, Component } from "vue-property-decorator";
import VueApexCharts from "vue-apexcharts";

Vue.component("apexchart", VueApexCharts);
@Component({
  components: { MyPlot }
})
export default class MyPlot extends Vue {
  witdhgraph: string = "500";
  typechart: string = "line";
  options: any = {
    chart: {
      id: "vuechart-example",
      toolbar: {
        show: true,
        offsetX: 0,
        offsetY: 0,
        tools: {
          download: true,
          selection: true,
          zoom: true,
          zoomin: true,
          zoomout: true,
          pan: true
        }
      },
      autoSelected: "selection"
    },
    stroke: {
      curve: "smooth"
    },
    colors: ["#00205b"],
    xaxis: {
      type: "numeric",
      categories: [
        0,
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        11,
        12,
        13,
        14,
        15,
        16,
        17,
        18,
        19,
        20,
        21,
        22,
        23,
        24,
        25,
        26,
        27,
        28,
        29,
        30,
        31,
        32,
        33,
        34,
        35,
        36,
        37,
        38,
        39,
        40,
        41,
        42,
        43,
        44,
        45,
        46,
        47,
        48,
        49
      ]
    },
    annotations: {
      position: "back",
      xaxis: [
        {
          x: 28,
          x2: 32,
          strokeDashArray: 1,
          borderColor: "#c2c2c2",
          fillColor: "#c2c2c2",
          opacity: 0.3,
          offsetX: 0,
          offsetY: 0,
          label: {
            borderColor: "#c2c2c2",
            borderWidth: 1,
            borderRadius: 2,
            text: "test ",
            textAnchor: "middle",
            position: "top",
            orientation: "horizontal",
            offsetX: 0,
            offsetY: 0,
            style: {
              background: "#fff",
              color: "#777",
              fontSize: "12px",
              fontWeight: 400,
              fontFamily: undefined,
              cssClass: "apexcharts-xaxis-annotation-label"
            }
          }
        }
      ]
    }
  };
  series: any = [
    {
      name: "series-1",
      data: [
        67,
        93,
        4,
        39,
        31,
        62,
        39,
        4,
        63,
        51,
        28,
        73,
        75,
        80,
        47,
        17,
        6,
        55,
        36,
        18,
        85,
        64,
        99,
        21,
        100,
        14,
        18,
        12,
        70,
        44,
        44,
        87,
        8,
        37,
        72,
        67,
        20,
        7,
        5,
        33,
        36,
        41,
        30,
        30,
        88,
        31,
        47,
        77,
        74,
        35
      ]
    }
  ];
}
</script>
vue.js toolbar apexcharts
1个回答
0
投票

您还需要启用

chart: {
  selection: {
    enabled: true
  }
}

现在未更正的文档中未提及此问题:https://apexcharts.com/docs/options/chart/toolbar/#selection

© www.soinside.com 2019 - 2024. All rights reserved.