从 highchart 点将数据发布到服务器
Posting data to the server from highchart points
我正在尝试 post 来自 highcharts 的数据。
point: {
events: {
click: function (e) {
hs.htmlExpand(null, {
pageOrigin: {
x: e.pageX || e.clientX,
y: e.pageY || e.clientY
},
headingText: this.series.name,
maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) + ':<br/> ' +
this.y + ' visits ' + '<div>'+'<button onclick="posting(this.y)">'+'send report' +'</button>'+'</div>',
width: 200
});
}
}
}
我在单击按钮时调用了一个函数,我想向它发送数据。我们如何将 this.y
发送到 posting()
函数,以便我们在函数中获得当前点值。 This fiddler 显示 undefined
处于警报状态。我怎样才能在那里获得 this.y
值。点击图表中的 points 然后点击 send report 按钮,你就会得到我的问题。
您必须将 this.y 值作为变量传递到字符串中。在第 84
行 this.y 的点击函数中检查我的修改
http://jsfiddle.net/8zsyg26a/2
maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) + ':<br/> ' +
this.y + ' visits ' + '<div>'+'<button onclick="posting(' + this.y + ')">'+'send report' +'</button>'+'</div>',
使用
就可以解决问题
<button onclick="posting('+this.y+')">'+'send report' +'</button>'+'</div>'
而不是
<button onclick="posting(this.y)">'+'send report' +'</button>'+'</div>'
我正在尝试 post 来自 highcharts 的数据。
point: {
events: {
click: function (e) {
hs.htmlExpand(null, {
pageOrigin: {
x: e.pageX || e.clientX,
y: e.pageY || e.clientY
},
headingText: this.series.name,
maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) + ':<br/> ' +
this.y + ' visits ' + '<div>'+'<button onclick="posting(this.y)">'+'send report' +'</button>'+'</div>',
width: 200
});
}
}
}
我在单击按钮时调用了一个函数,我想向它发送数据。我们如何将 this.y
发送到 posting()
函数,以便我们在函数中获得当前点值。 This fiddler 显示 undefined
处于警报状态。我怎样才能在那里获得 this.y
值。点击图表中的 points 然后点击 send report 按钮,你就会得到我的问题。
您必须将 this.y 值作为变量传递到字符串中。在第 84
行 this.y 的点击函数中检查我的修改http://jsfiddle.net/8zsyg26a/2
maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) + ':<br/> ' +
this.y + ' visits ' + '<div>'+'<button onclick="posting(' + this.y + ')">'+'send report' +'</button>'+'</div>',
使用
就可以解决问题<button onclick="posting('+this.y+')">'+'send report' +'</button>'+'</div>'
而不是
<button onclick="posting(this.y)">'+'send report' +'</button>'+'</div>'