JSFiddle - React, Tailwind, and code Playground
by rgendron
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/funnel.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 410px; max-width: 600px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function() {
$('#container').highcharts({
chart: {
type: 'funnel',
events: {
load: function() {
var chart = this;
Highcharts.each(chart.series[0].data, function(p, i) {
p.dataLabel.attr({
x: (chart.plotWidth - chart.plotLeft) / 2,
'text-anchor': 'middle'
})
})
},
redraw: function() {
var chart = this;
Highcharts.each(chart.series[0].data, function(p, i) {
p.dataLabel.attr({
x: (chart.plotWidth - chart.plotLeft) / 2,
'text-anchor': 'middle'
})
})
}
}
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
connectorWidth: 0,
distance: 0,
softConnetor: true,
format: '<b>{point.name}</b> ({point.y:,.0f})',
},
neckWidth: '50%',
neckHeight: '100%'
}
},
series: [{
data: [
['Created', 10037],
['Ready', 8880],
['Emailed', 9787],
['Responded', 700],
['Prospect', 700],
['Active', 698]
]
}]
});
});