JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/funnel.js"></script>
<div id="container" style="min-width: 410px; max-width: 600px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
Highcharts.seriesTypes.pyramid.prototype.animate = function (init) {
var chart = this.chart,
animation = this.options.animation,
group = this.group,
xAxis = this.xAxis,
yAxis = this.yAxis,
left = this.chart.plotLeft,
top = this.chart.plotTop;
if (chart.renderer.isSVG) {
if (animation === true) {
animation = {
duration: 1000
};
}
// Initialize the animation
if (init) {
// Scale down the group and place it in the center
group.attr({
translateX: left + this.chart.plotWidth / 2,
// translateY: top + this.chart.plotHeight / 2,
scaleX: 0.001, // #1499
// scaleY: 0.001
});
// Run the animation
} else {
group.animate({
translateX: left,
// translateY: top,
scaleX: 1,
// scaleY: 1
}, animation);
// Delete this function to allow it only once
this.animate = null;
}
}
};
Highcharts.chart('container', {
chart: {
type: 'pyramid',
},
title: {
text: '',
x: -50
},
colors:[ "#ccc", "#92af6d", "#de9b44" , "#178BCA"],
plotOptions: {
series: {
animation: true,
dataLabels: {
enabled: true,
format: '<b>{point.name}</b> ({point.y:,.0f}%)',
color: '#000',
style:{
width: '200px',
fontSize: '15px'
},
softConnector: true
}
}
},
tooltip:{
style: {
fontFamily: 'Roboto'
},
borderColor: '#777',
formatter: function() {
return this.point.name +": " + this.y +'%';
},
},
legend: {
enabled: false
},
exporting:{
enabled: false
},
credits:{
enabled: false
...