Rounded Spaced Donut in JavaScript
Using ApexCharts with JavaScript
This Rounded Spaced Donut example uses ApexCharts.js directly in JavaScript, with no wrapper component.
Install it with npm install apexcharts, then mount the chart with new ApexCharts(element, options).render().
var options = {
series: [44, 55, 41, 17, 15],
chart: {
type: 'donut',
height: 380,
},
labels: ['Comedy', 'Action', 'SciFi', 'Drama', 'Horror'],
colors: ['#6366F1', '#0EA5E9', '#22C55E', '#F59E0B', '#EF4444'],
plotOptions: {
pie: {
borderRadius: 8,
spacing: 3,
donut: {
size: '62%',
},
},
},
stroke: {
width: 0,
},
legend: {
position: 'bottom',
},
title: {
text: 'Rounded, spaced donut slices',
align: 'left',
},
}
var chart = new ApexCharts(document.querySelector('#chart'), options)
chart.render()