Highcharts Demo
author(s): Torstein Hønsi
by skilesare
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
cursor: 'pointer',
events: {
click: function (event) {
debugger
if (event.currentTarget.series != null) {
chartModel = event.currentTarget.series.chart;
x = chartModel.xAxis[0].toValue(event.chartX);
y = chartModel.yAxis[0].toValue(event.chartY);
chartModel.xAxis[0].removePlotLine("xmarker");
chartModel.yAxis[0].removePlotLine("ymarker0");
chartModel.yAxis[1].removePlotLine("ymarker1");
chartModel.xAxis[0].addPlotLine({
id: 'xmarker',
zIndex: 1000,
color: '#F01818',
width: 1,
value: x,
dashStyle: 'longdashdot',
label: {
text: x.toFixed(3) + ' ' + chartModel.xAxis[0].axis.axisTitle.text
}
});
chartModel.yAxis[0].addPlotLine({
id: 'ymarker0',
zIndex: 1000,
color: '#F01818',
width: 1,
value: y,
dashStyle: 'longdashdot',
label: {
text: y.toFixed(3) + ' ' + chartModel.yAxis[0].axis.axisTitle.text,
...