Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable download option on apexcharts?

I am use apexcharts vue bindings to plot a few bar charts.

As told by docs it should be possible to disable the toolbar by set show:false as seen there.

So i did it on my helper function:

// 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"
      }
    }
  }
});

and i pass it to my vue component this way:

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

However the menu is still there:

enter image description here

Any guidance is welcome.

like image 457
Sombriks Avatar asked Jan 04 '19 01:01

Sombriks


People also ask

How do I disable Apexcharts toolbar?

As told by docs it should be possible to disable the toolbar by set show:false as seen there.

How do I hide series in Apexcharts?

hideSeries() will hide a visible data series and showSeries() shows a hidden series.

How do I update series in Apexcharts?

Get data with jQuery. var url = 'http://my-json-server.typicode.com/apexcharts/apexcharts.js/yearly'; $. getJSON(url, function(response) { chart. updateSeries([{ name: 'Sales', data: response }]) }); The above implementation specifies a success handler in which we get our response from the API.

How do I change the color of an Apexchart bar?

To set fill colors globally for all charts, use Apex. fill. colors .


2 Answers

toolbar should be under chart key

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

You can check my demo here

like image 171
ittus Avatar answered Oct 22 '22 06:10

ittus


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

Can only disable download option , but toolbar exists

like image 24
Inshaf Ahmed Avatar answered Oct 22 '22 06:10

Inshaf Ahmed