如何在Highcharts中的点事件函数中获取图表对象
how to get chart object inside a point event function in Highcharts
即使在单击第二个系列中的点时,我也要如何修改以下示例以获得第一个系列的点值?得到chart
对象对我来说就足够了,但我不知道该怎么做(点mouseOut
函数this
内部指的是point
对象,而不是chart
对象)。
$(function () {
$('#container').highcharts({
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
// here I want the y value of the point in the
// first series even in this function
// is invoked for the point in the second series
alert('value: ' + this.y);
}
}
}
}
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0]
},{
data: [135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
});
JSfiddle页面
根据文档:
this关键字指的是Point对象。
Point
又具有保持chart
:的series
属性
series: {
cursor: 'pointer',
point: {
events: {
click: function() {
var chart = this.series.chart;
}
}
}
}
相关文章:
- Javascript:如何获取函数.apply()的键
- 如何在 JavaScript 中获取函数体文本
- 从函数内部获取函数的名称
- 从字符串的 JS 函数中获取函数参数
- 获取函数中按钮的名称
- 在其参数中获取函数本身
- 如何获取函数元素中的值
- 获取函数原型的源代码
- javascript:获取函数's变量's在另一个函数中的值
- 无法获取函数的ajax回调
- Javascript通过名称获取函数
- 如何获取函数参数值
- 使用Rhino从已评估的JS中获取函数名及其参数
- 获取函数jQuery设置的属性
- 获取函数的arity
- AJAX请求在jQuery中获取函数,变量问题
- 获取函数的表单隐藏变量
- 如何从外部JavaScript文件获取函数参数
- 不要在 Codeigniter 中获取函数参数
- 客户端 JavaScript 从服务器端文档集和获取函数接收过时的值