Simple Pie in JavaScript
Using ApexCharts with JavaScript
This Simple Pie 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: [42, 23, 15, 12, 8],
chart: {
width: 480,
type: 'pie',
},
labels: ['Organic Search', 'Direct', 'Social', 'Referral', 'Email'],
title: {
text: 'Website Traffic by Source',
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()