Highcharts Demo
author(s):
Torstein Hønsi
by manikandankathirvel
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="height: 300px"></div>
<button id="title" class="autocompare">Set title</button>
<button id="subtitle" class="autocompare">Set subtitle</button>
<button id="color" class="autocompare">New color</button>
JavaScript
var i = 1,
chart;
chart = Highcharts.chart('container', {
subtitle: {
text: 'Subtitle'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
chart.setTitle({ text: 'sssssssssssssss ' + i });
$('#title').click(function () {
chart.setTitle({ text: 'New title ' + i });
i += 1;
});
$('#subtitle').click(function () {
chart.setTitle(null, { text: 'New title ' + i });
i += 1;
});
$('#color').click(function () {
chart.setTitle(
{ style: { color: 'red' } },
{ style: { color: 'green' } }
);
});