Highcharts Demo
author(s):
Slawek Kolodziej
by Torstein Hønsi
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px; margin-top: 1em"></div>
<input type="checkbox" id="horizontal-line" /><label for="horizontal-line">
<i class="icon-ellipsis-horizontal"></i>
</label>
CSS
</style>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<style type="text/css">
JavaScript
$(function () {
$('#container').highcharts({
chart: {
events: {
click: function (e) {
if ($('#horizontal-line')[0].checked) {
this.yAxis[0].addPlotLine({
value: this.yAxis[0].toValue(e.chartY),
width: 2,
color: '#000000'
});
}
}
}
},
title: {
text: 'Chart title'
},
credits: {
enabled: false
},
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]
}]
});
$('#horizontal-line').button();
});