Simple Donut in JavaScript
Using ApexCharts with JavaScript
This Simple 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: [54, 41, 38, 16, 12],
chart: {
width: 480,
type: 'donut',
},
labels: [
'North America',
'Europe',
'Asia Pacific',
'Latin America',
'Middle East',
],
title: {
text: 'Revenue by Region ($M)',
align: 'center',
},
legend: {
show: false,
},
plotOptions: {
pie: {
dataLabels: {
external: {
show: true,
},
},
},
},
responsive: [
{
breakpoint: 480,
options: {
chart: {
width: 320,
},
},
},
],
}
var chart = new ApexCharts(document.querySelector('#chart'), options)
chart.render()