apexcharts / apexcharts.js

📊 Interactive JavaScript Charts built on SVG
https://apexcharts.com
MIT License
14.29k stars 1.3k forks source link

Transparent background #895

Closed PrimozRome closed 5 years ago

PrimozRome commented 5 years ago

Can a chart have transparent background? How to achieve it? I tried this but nothing gave me the desired result:

options: {
   chart: {
      background: 'transparent'
    }
}

options: {
   chart: {
      background: 'none'
    }
}
wasifHafeez commented 5 years ago

It is already transparent, and if you change the color, it changes, see here

so please describe your problem specifically, what and where you want to achieve this, include with the code which you are using, maybe your parent "div" has some background color, Plus in your code you were trying to add "chart" inside "options"

PrimozRome commented 5 years ago

@wasifHafeez thank a lot, got it !

wasifHafeez commented 5 years ago

Could you please share the link of the chart? Which you are trying to use.

@wasifHafeez thank a lot, got it !

Is the issue resolved?

PrimozRome commented 5 years ago

@wasifHafeez not quite. Just tested it and my result is white background... Here is my options object:

      options: {
        chart: {
          height: 100
        }
      }

Result is white background:

Screenshot 2019-09-05 at 13 29 39

Maybe thing to note. I use Vue.js integration.

wasifHafeez commented 5 years ago

please share a live example, codepen or any other live example with Vue.js

PrimozRome commented 5 years ago

OK I need time to prepare codepen project. Basically here is my full code and it renders what you see on above picture with white background:

<template>
  <div id="statistics">
       <vue-apex-charts
            slot="value" 
            type="donut"
            class="chart"
            :options="options"
            :series="series"
       />
  </div>
</template>

<script>
import VueApexCharts from 'vue-apexcharts'

export default {
  name: 'ProductStatistics',

  components: {
    VueApexCharts
  },

  data() {
    return {
      series: [44, 55, 41, 17, 15, 22],
      options: {
        labels: ['Automotive', 'Aerospace', 'Power & Energy', 'Industrial', 'Military', 'Civil Engineering'],
        chart: {
          height: 100
        }
      }
    }
  }
}
</script>

If I change to this I get:

  data() {
    return {
      series: [44, 55, 41, 17, 15, 22],
      options: {
        labels: ['Automotive', 'Aerospace', 'Power & Energy', 'Industrial', 'Military', 'Civil Engineering'],
        chart: {
          background: 'red',
          height: 100
        }
      }
    }
  }
Screenshot 2019-09-05 at 13 56 34
PrimozRome commented 5 years ago

@wasifHafeez you can close this. It was my stupid mistake. Sorry for the inconvenience.

rishabbahal9 commented 3 years ago

Use background: '0' At-least this works for me

chart: {
          type: 'bar',
          height: 350,
          background: '0'
        },