как отключить опцию загрузки на apexcharts?

Я использую привязки vue apexcharts для построения нескольких столбчатых диаграмм.

Как сказано в документации, должна быть возможность отключить панель инструментов, установив show: false как видно там .

Итак, я сделал это со своей вспомогательной функцией:

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

Однако меню все еще есть:

введите описание изображения здесь

Любое руководство приветствуется.


person Sombriks    schedule 04.01.2019    source источник


Ответы (3)


toolbar должен находиться под chart ключом

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

Вы можете проверить мою демонстрацию здесь

person ittus    schedule 04.01.2019

  chart: {
      toolbar: {
        show: true,
        tools:{
          download:false // <== line to add
        }
      }
    }

Можно только отключить опцию загрузки, но панель инструментов существует

person Inshaf Ahmed    schedule 05.07.2021

редактировать эту строку может помочь вам

{chart: {toolbar: {show: false
}},
  colors: randomColor({
    luminosity: "light",
    hue: "blue",
    count: 30
  }),
  plotOptions: {
    bar: {
      distributed: true,
      horizontal: true
    }
  },
}
person Ahsan    schedule 05.07.2021
comment
Пожалуйста, добавьте подробности, чтобы пользователи (включая OP) понимали, почему это будет работать вместо существующего кода. - person Tushar Shahi; 05.07.2021