Highcharts - javascript 事件点击函数给出错误 e.call 不是函数
Highcharts - javascript function on event click gives error e.call is not a function
我正在使用 Highstock 5.0.7。我的图表选项存储在数据库中,我正在获取它以绘制图表。我需要在单击堆积柱形图时调用一些 ajax 函数。堆叠柱形图显示正确,但问题是,当我单击堆叠时,出现 JS 错误,提示 e.call 不是函数。下面是JS错误。
highstock.js:29 Uncaught TypeError: e.call is not a function
a.fireEvent @ highstock.js:29
E.firePointEvent @ highstock.js:271
a.Pointer.onContainerClick @ highstock.js:209
l.onclick @ highstock.js:210
plotOption->Series->points->events->click下写javascript的图表选项
"chart": {
"type": "column"
},
"credits" : {
"enabled" : false
},
"title" : {
"text" : "chartName"
},
"xAxis": {
"categories": []
},
"yAxis": {
"min": 0,
"stackLabels": {
"enabled": true,
"style": {
"fontWeight": "bold",
"color": "gray"
}
}
},
"legend": {
"enabled":true
},
"tooltip": {
"headerFormat": "<b>{point.x}</b><br/>",
"pointFormat": "{series.name}: {point.y}<br/>Total: {point.stackTotal}"
},
"plotOptions": {
"column": {
"stacking": "normal",
"dataLabels": {
"enabled": true,
"color": "white",
"style": {
"textShadow": "0 0 3px black"
}
}
},
"series": {
"cursor": "pointer",
"point": {
"events": {
"click": "function () {alert(y.value);}"
}
}
}
},
"series": []
}
下面是我正在使用的脚本标签
<script src="./resources/js/highstock/highstock.js"></script>
<script src="./resources/js/highstock/highcharts-more.js"></script>
<script src="./resources/js/highstock/highcharts-3d.js"></script>
<script src="./resources/js/highstock/modules/solid-gauge.js"></script>
<script src="./resources/js/highstock/modules/exporting.js"></script>
<script src="./resources/js/highstock/modules/offline-exporting.js"></script>
<script src="./resources/js/highstock/modules/drilldown.js"></script>
你的点击事件定义为
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
alert(this.y); /*not y.value*/
}
}
}
}
fiddle 演示
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
console.log("this : ",this)
console.log('this.y',this.y)
alert(this.y);
}
}
}
}
我正在使用 Highstock 5.0.7。我的图表选项存储在数据库中,我正在获取它以绘制图表。我需要在单击堆积柱形图时调用一些 ajax 函数。堆叠柱形图显示正确,但问题是,当我单击堆叠时,出现 JS 错误,提示 e.call 不是函数。下面是JS错误。
highstock.js:29 Uncaught TypeError: e.call is not a function
a.fireEvent @ highstock.js:29
E.firePointEvent @ highstock.js:271
a.Pointer.onContainerClick @ highstock.js:209
l.onclick @ highstock.js:210
plotOption->Series->points->events->click下写javascript的图表选项
"chart": {
"type": "column"
},
"credits" : {
"enabled" : false
},
"title" : {
"text" : "chartName"
},
"xAxis": {
"categories": []
},
"yAxis": {
"min": 0,
"stackLabels": {
"enabled": true,
"style": {
"fontWeight": "bold",
"color": "gray"
}
}
},
"legend": {
"enabled":true
},
"tooltip": {
"headerFormat": "<b>{point.x}</b><br/>",
"pointFormat": "{series.name}: {point.y}<br/>Total: {point.stackTotal}"
},
"plotOptions": {
"column": {
"stacking": "normal",
"dataLabels": {
"enabled": true,
"color": "white",
"style": {
"textShadow": "0 0 3px black"
}
}
},
"series": {
"cursor": "pointer",
"point": {
"events": {
"click": "function () {alert(y.value);}"
}
}
}
},
"series": []
}
下面是我正在使用的脚本标签
<script src="./resources/js/highstock/highstock.js"></script>
<script src="./resources/js/highstock/highcharts-more.js"></script>
<script src="./resources/js/highstock/highcharts-3d.js"></script>
<script src="./resources/js/highstock/modules/solid-gauge.js"></script>
<script src="./resources/js/highstock/modules/exporting.js"></script>
<script src="./resources/js/highstock/modules/offline-exporting.js"></script>
<script src="./resources/js/highstock/modules/drilldown.js"></script>
你的点击事件定义为
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
alert(this.y); /*not y.value*/
}
}
}
}
fiddle 演示
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
console.log("this : ",this)
console.log('this.y',this.y)
alert(this.y);
}
}
}
}