Basic Bar in JavaScript
Using ApexCharts with JavaScript
This Basic Bar 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: [
{
name: 'Visitors',
data: [400, 430, 448, 470, 540, 580, 690, 1100, 1200, 1380],
},
],
chart: {
type: 'bar',
height: 350,
},
plotOptions: {
bar: {
borderRadius: 4,
borderRadiusApplication: 'end',
horizontal: true,
},
},
dataLabels: {
enabled: false,
},
title: {
text: 'Monthly Visitors by Country',
align: 'left',
},
xaxis: {
categories: [
'South Korea',
'Canada',
'United Kingdom',
'Netherlands',
'Italy',
'France',
'Japan',
'United States',
'China',
'Germany',
],
labels: {
formatter: function (val) {
return val + 'k'
},
},
},
}
var chart = new ApexCharts(document.querySelector('#chart'), options)
chart.render()