Marcus Derem
Marcus Derem

Reputation: 115

Change border color of donut chart

I made a DONUT chart with APEXCHARTS. It looks like this:
chart
Here is my code:

var options = {
          series: [44, 55, 41, 17, 15],
          labels: ['Apple', 'Mango', 'Orange', 'Watermelon', 'test'],
        chart: {
          type: 'donut',
          foreColor: '#ffffff'
        },
        grid: {
          borderColor: "#EF3252"
        },
        plotOptions: {
          pie: {
            expandOnClick: false
          }
        },
        responsive: [{
          breakpoint: 480,
          options: {
            chart: {
              width: '100%'
            },
            legend: {
              position: 'bottom'
            }
          }
        }],
        datasets: [{
          borderColor: ["#EF3252"]
        }]
        };

   var chart = new ApexCharts(document.getElementById("stats1_chart1"), options);
   chart.render();
<div id="stats1_chart1"></div>

<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>

I want to achieve to change the border-color. But I can't figure out how this should work.
~Marcus

Upvotes: 5

Views: 7427

Answers (2)

anaszaman
anaszaman

Reputation: 297

To completely remove stroke, do following;

stroke: {
        show: false,
        width:0
    },

Upvotes: 6

Max K
Max K

Reputation: 1121

Just add the stroke attribute:

var options = {
          series: [44, 55, 41, 17, 15],
          labels: ['Apple', 'Mango', 'Orange', 'Watermelon', 'test'],
        chart: {
          type: 'donut',
          foreColor: '#ffffff'
        },
        grid: {
          borderColor: "#EF3252"
        },
        plotOptions: {
          pie: {
            expandOnClick: false
          }
        },
        stroke:{
         colors:['#000']
        },
        responsive: [{
          breakpoint: 480,
          options: {
            chart: {
              width: '100%'
            },
            legend: {
              position: 'bottom'
            }
          }
        }],
        datasets: [{
          borderColor: ["#EF3252"]
        }]
        };

   var chart = new ApexCharts(document.getElementById("stats1_chart1"), options);
   chart.render();
<div id="stats1_chart1"></div>

<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>

Upvotes: 13

Related Questions