我正在使用Highstock 5.0.7。我的圖表選項存儲在數據庫中,我正在讀取它以獲取繪製的圖表。我需要在點擊堆積的柱形圖時調用一些ajax函數。堆積柱狀圖顯示正確,但問題是,當我點擊堆棧時,我得到一個JS錯誤,說e.call不是一個函數。下面是JS錯誤。Highcharts - 事件點擊時的javascript函數給出錯誤e.call不是函數
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
在JavaScript是下plotOption->系列 - >點 - >事件 - 寫在圖表選項>點擊
"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>
你需要[EVAL(https://www.w3schools.com/jsref/jsref_eval.asp)點擊事件功能 - 如果你不這樣做,你有一個字符串,而不是在click事件上調用的函數。 – morganfree