JSFiddle - React, Tailwind, and code Playground
by johnnytrinh
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
var categories = [
'Tokyo',
'Jakarta',
'New York',
'Seoul',
'Kolkata',
'Los Angeles',
'Shanghai',
'Moscow',
'Beijing',
'Buenos Aires',
'Guangzhou',
'Shenzhen',
'Istanbul'];
$('#container').highcharts({
chart: {
type: 'column',
margin: [50, 50, 100, 80]
},
title: {
text: 'Problematic Y-Axis labels'
},
xAxis: {
minPadding: 0.1, // This doesn't work
labels: {
rotation: -45,
align: 'right',
formatter: function(){
return categories[this.value];
},
style: {
fontSize: '13px',
fontFamily: 'Verdana, sans-serif'
}
}
},
yAxis: {
labels: {
align: 'left',
x: 0,
y: -8
},
min: 0,
title: {
text: 'Population (millions)'
}
},
plotOptions: {
column: {
pointPadding: 0
}
},
legend: {
enabled: false
},
tooltip: {
formatter: function () {
return '<b>' + this.x + '</b><br/>' +
'Population in 2008: ' + Highcharts.numberFormat(this.y, 1) +
' millions';
}
},
series: [{
name: 'Population',
data: [430, 218, 201, 200, 196, 105],
dataLabels: {
enabled: true,
rotation: -90,
color: '#FFFFFF',
align: 'right',
x: 4,
y: 10,
style:...