Stroked Gauge in JavaScript
Using ApexCharts with JavaScript
This Stroked Gauge 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: [78],
chart: {
height: 350,
type: 'radialBar',
offsetY: -10,
},
plotOptions: {
radialBar: {
startAngle: -135,
endAngle: 135,
dataLabels: {
name: {
fontSize: '16px',
color: undefined,
offsetY: 120,
},
value: {
offsetY: 76,
fontSize: '22px',
color: undefined,
formatter: function (val) {
return val + '%'
},
},
},
},
},
fill: {
type: 'gradient',
gradient: {
shade: 'dark',
shadeIntensity: 0.15,
inverseColors: false,
opacityFrom: 1,
opacityTo: 1,
stops: [0, 50, 65, 91],
},
},
stroke: {
dashArray: 4,
},
colors: ['#20E647'],
labels: ['Battery Health'],
}
var chart = new ApexCharts(document.querySelector('#chart'), options)
chart.render()