Highcharts Demo
author(s): Torstein Hønsi
by Mi Ku
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
<button id="large">Large</button>
<button id="small">Small</button>
CSS
#container {
height: 300px;
min-width: 310px;
max-width: 800px;
}
JavaScript
var chart = Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: 'Highcharts',
align: 'left'
},
subtitle: {
text: 'Resize the frame to see the legend position change'
},
legend: {
align: 'right',
verticalAlign: 'middle',
layout: 'vertical'
},
xAxis: {
labels: {
style: {
fontSize: '14px'
}
},
categories: ['Apples', 'Oranges', 'Bananas']
},
yAxis: {
title: {
text: 'Amount'
},
labels: {
style: {
fontSize: '14px'
}
}
},
series: [{
name: 'Christmas Eve',
data: [1, 4, 3]
}, {
name: 'Christmas Day before dinner',
data: [6, 4, 2]
}, {
name: 'Christmas Day after dinner',
data: [8, 4, 3]
}],
responsive: {
rules: [{
condition: {
maxWidth: 500
},
chartOptions: {
title: {
align: 'center'
},
legend: {
align: 'center',
verticalAlign: 'bottom',
layout: 'horizontal'
},
xAxis: {
labels: {
style: {
fontSize: '12px'
}
}
}
}
}]
}
});
$('#small').click(function () {
chart.setSize(400, 300);
});
$('#large').click(function () {
chart.setSize(600, 300);
});