【发布时间】:2013-08-28 06:33:24
【问题描述】:
我想在 xAxis 上拖动 plotLine 并检测此更改。
有人可以举个例子吗?
编辑
@DiMono
这是我到目前为止所尝试的。单击事件未触发。 通过这种方法,我想添加、dragstart、dragend 等事件来启用拖动功能。
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
</head>
<body>
<div id="container" style ="height : 400px">
</div>
</body>
<script type="text/javascript">
(function(H){
H.Chart.prototype.callbacks.push(function(chart){
H.addEvent(chart.xAxis[0].plotLinesAndBands[0].svgElem,'click',function(e){
console.log('click from plugin');
});
});
}(Highcharts));
$(document).ready(function(){
var chart = new Highcharts.Chart({
chart : {
renderTo: 'container'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
plotLines: [{
color: '#FF0000',
width: 2,
value: 5.5
}]
},
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]
}]
});
});
</script>
</html>
【问题讨论】:
-
你能告诉我们你已经尝试过什么吗?我们不会简单地为您编写代码,但如果您的代码无法正常工作,我们可以帮助您修复它。
-
你能取消对这个问题的保留吗?
标签: highcharts