JSFiddle - React, Tailwind, and code Playground
by anikettiwari
HTML
<script src="https://code.highcharts.com/7.0.1/highcharts.js"></script>
<div id="container"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
type: 'column',
// margin: 75,
events: {
load: function () {
var theChart = this;
var theSeries = this.series;
var removeIndex = [];
var weight = 0;
for (var key in theSeries) {
var aSeries = theSeries[key];
if (aSeries.data[0].y == 0) {
removeIndex.push(parseInt(key));
}
}
for (var i in removeIndex) {
var iRemove = removeIndex[i] - weight;
theChart.series[iRemove].remove();
weight = weight + 1;
}
}
}
},
title: {
text: '# of devices by manufacturer'
},
subtitle: {
text: ''
},
plotOptions: {
column: {
//depth: 25
}
},
xAxis: {
categories: ['# of devices']
},
yAxis: {
// allowDecimals: false,
// min: 0,
title: {
text: ''
}
},
series: [{
name: 'Samsung',
data: [6]
}, {
name: 'LG',
data: [10]
}, {
name: 'Apple',
data: [22]
}, {
name: 'Nokia',
data: [7]
}, {
name: 'Motorola',
data: [3]
}, {
name: 'Sony Ericsson',
data: [0]
}, {
name: 'Nintendo',
data: [0]
}, {
name: 'Unknown',
data: [45]
}, {
name: 'Others',
data: [54]
}]
});
});