<template>
<div>
<div id="chart">
<apexchart
type="donut"
width="380"
:options="chartOptions"
:series="series"
></apexchart>
</div>
</div>
</template>
<script>
import VueApexCharts from 'vue-apexcharts'
export default {
components: {
apexchart: VueApexCharts,
},
data: function () {
return {
series: [128, 96, 74, 52, 38],
chartOptions: {
chart: {
width: 380,
type: 'donut',
},
plotOptions: {
pie: {
startAngle: -90,
endAngle: 270,
},
},
labels: ['Compute', 'Storage', 'Database', 'Networking', 'Analytics'],
dataLabels: {
enabled: false,
},
fill: {
type: 'gradient',
},
legend: {
formatter: function (val, opts) {
return val + ' - $' + opts.w.globals.series[opts.seriesIndex] + 'k'
},
},
title: {
text: 'Cloud Spend by Service',
},
responsive: [
{
breakpoint: 480,
options: {
chart: {
width: 200,
},
legend: {
position: 'bottom',
},
},
},
],
},
}
},
}
</script>
<style>
#chart {
max-width: 380px;
margin: 35px auto;
padding: 0;
}
.apexcharts-legend-text tspan:nth-child(1) {
font-weight: lighter;
fill: #999;
}
.apexcharts-legend-text tspan:nth-child(3) {
font-weight: bold;
}
</style>