Highchart line with bar chart
by Kieran Dang
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
zoomType: 'xy'
},
title: {
text: 'Vietnam 3G subscriptions'
},
xAxis: [{
categories: ['2012', '2013', '2014', '2015'],
crosshair: true
}],
yAxis: [{ // Primary yAxis
labels: {
format: '{value} m',
style: {
color: Highcharts.getOptions().colors[1]
}
},
title: {
text: 'Millions',
style: {
color: Highcharts.getOptions().colors[1]
}
}
}, { // Secondary yAxis
title: {
text: '% over total',
style: {
color: Highcharts.getOptions().colors[0]
}
},
labels: {
format: '{value} %',
style: {
color: Highcharts.getOptions().colors[0]
}
},
dataLabels: {
enabled: true
},
opposite: true
}],
tooltip: {
shared: true
},
legend: {
layout: 'vertical',
align: 'left',
x: 120,
verticalAlign: 'top',
y: 100,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
},
series: [{
name: '3G',
type: 'column',
dataLabels: {
enabled: true,
color: '#666',
},
data: [15.7, 19.7, 27.5, 29.5],
tooltip: {
valueSuffix: ' million'
}
}, {
name: '% over total',
type: 'spline',
yAxis: 1,
dataLabels: {
enabled: true
},
...