admin管理员组文章数量:1390391
I'm using the HighStock stock charting library to generate a basic OHLC stock chart. I want to perform some action when the chart is generated (and after it's regenerated by changing the displayed time frame). I'm trying to do this using the plotOptions.ohlc.events.show
event (documentation).
The problem I'm having is the even isn't firing at all. If I follow the example for the click event, the alert fires correctly when I click the series.
var chart = new Highcharts.StockChart({
chart: {
renderTo: 'divChart',
height: 450
},
rangeSelector: {
selected: 2
},
xAxis: {
maxZoom: 14 * 24 * 3600000
},
yAxis: [{
title: {
text: 'OHLC'
},
height: 200,
lineWidth: 2
}, {
title: {
text: 'Volume'
},
top: 250,
height: 100,
offset: 0,
lineWidth: 2
}],
title: {
text: 'Stock Chart'
},
series: [{
type: 'ohlc',
name: 'Prices',
id: 'prices',
data: ohlc
}, {
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1
}],
// The event I am trying to bind to
plotOptions: {
series: {
events: {
show: function () {
alert("show");
}
}
}
}
});
- Is this the correct way to fire an event when the chart is redrawn?
- If so, why isn't the event firing, and how do I fix it?
I'm using the HighStock stock charting library to generate a basic OHLC stock chart. I want to perform some action when the chart is generated (and after it's regenerated by changing the displayed time frame). I'm trying to do this using the plotOptions.ohlc.events.show
event (documentation).
The problem I'm having is the even isn't firing at all. If I follow the example for the click event, the alert fires correctly when I click the series.
var chart = new Highcharts.StockChart({
chart: {
renderTo: 'divChart',
height: 450
},
rangeSelector: {
selected: 2
},
xAxis: {
maxZoom: 14 * 24 * 3600000
},
yAxis: [{
title: {
text: 'OHLC'
},
height: 200,
lineWidth: 2
}, {
title: {
text: 'Volume'
},
top: 250,
height: 100,
offset: 0,
lineWidth: 2
}],
title: {
text: 'Stock Chart'
},
series: [{
type: 'ohlc',
name: 'Prices',
id: 'prices',
data: ohlc
}, {
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1
}],
// The event I am trying to bind to
plotOptions: {
series: {
events: {
show: function () {
alert("show");
}
}
}
}
});
- Is this the correct way to fire an event when the chart is redrawn?
- If so, why isn't the event firing, and how do I fix it?
1 Answer
Reset to default 6Change the chart part to something similar
chart: {
renderTo: 'container',
events: {
redraw: function(){ // or load - refer to API documentation
alert('Chart Loaded');
}
}
},
They've got a nice API browser - might e in handy http://www.highcharts./ref/#chart-events--load
本文标签: javascriptHighCharts Stock Chart fire event on chart redrawStack Overflow
版权声明:本文标题:javascript - HighCharts Stock Chart fire event on chart redraw? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744690655a2619976.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论