javascript - 如何禁用 apexcharts 上的下载选项?

标签 javascript vue.js apexcharts

我正在使用 apexcharts vue bindings绘制一些条形图。

如文档所述,应该可以通过设置 show:false 来禁用工具栏,如所见 there .

所以我在我的辅助函数上做了:

// do-char-options.js
const randomColor = require("randomcolor");
module.exports = labels => ({
  toolbar: { show:false },// docs says it should do the trick
  colors: randomColor({
    luminosity: "light",
    hue: "blue",
    count: 30
  }),
  plotOptions: {
    bar: { distributed: true, horizontal: true }
  },
  tooltip: {
    theme: "dark"
  },
  xaxis: {
    categories: labels,
    color: "white",
    labels: {
      style: {
        colors: ["white"]
      }
    }
  },
  yaxis: {
    labels: {
      style: {
        color: "white"
      }
    }
  }
});

然后我以这种方式将它传递给我的 vue 组件:

<template>
    <v-layout row justify-center wrap>
        <v-flex xs12>
            <apexchart type="bar" height="500" :options="chartOptions" :series="series"/>
        </v-flex>
    </v-layout>
</template>

<script>
const doOptions = require("./do-chart-options");
const labels = [
    "Javascript",
    "Java",
    "SQL",
    "HTML",
    "CSS",
    "C",
    "C++",
    "PHP",
    "Python",
    "GO",
    "Ruby"
];
module.exports = {
    name: "chart-languages",
    data: _ => ({
        series: [{ data: [160, 110, 90, 85, 80, 80, 60, 30, 15, 14, 9] }],
        chartOptions: doOptions(labels)
    })
};
</script>

但是菜单仍然存在:

enter image description here

欢迎任何指导。

最佳答案

toolbar 应该在 chart 键下

{
  chart: {
    toolbar: {
      show: false
    }
  },
  colors: randomColor({
    luminosity: "light",
    hue: "blue",
    count: 30
  }),
  plotOptions: {
    bar: {
      distributed: true,
      horizontal: true
    }
  },
  ...
}

你可以查看我的演示here

关于javascript - 如何禁用 apexcharts 上的下载选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54032232/

相关文章:

Javascript 函数每 2 分钟运行一次,无需加载另一个页面

validation - vee-validate 以什么顺序与验证器一起工作? (同步和异步)

javascript - 在 Created 或 Mounted Hook 中访问组件数据

model - 在 Vuejs 中跨不同组件共享数据

javascript - 顶点图表文本 chop 自定义

javascript - 使用 Bootstrap Vue 在 Vue JS 上单击选项卡后如何加载组件?

javascript - 如何仅使用一个数据绑定(bind)来调用 2 个函数?

javascript - 在 JS 中使用高阶函数避免重复?

reactjs - 无法在 React apex-chart 中将时间戳转换为小时、分钟和秒

javascript - 基本的 Node.js 转换流出现问题