Highcharts Demo
author(s):
Torstein Hønsi
by J. Albert Bowden
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;
}
.small-chart .highcharts-subtitle {
display: none;
}
.small-chart .highcharts-legend {
display: none;
}
JavaScript
var chart = Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: 'Highcharts responsive chart'
},
subtitle: {
text: 'Resize the frame to see subtitle and legend hide'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Bananas']
},
yAxis: {
title: {
text: 'Amount'
}
},
series: [{
name: 'Fruits',
data: [1, 4, 3]
}],
responsive: {
rules: [{
condition: {
maxWidth: 500
},
chartOptions: {
chart: {
className: 'small-chart'
}
}
}]
}
});
$('#small').click(function () {
chart.setSize(400, 300);
});
$('#large').click(function () {
chart.setSize(600, 300);
});