I am using hightchart plugin in Yii2 application. Now When I want call some event like click on series point the plugin shows an error Uncaught TypeError: fn.call is not a function please help me. My Js code for high chart is like that
Highcharts.setOptions([]);
new Highcharts.Chart({
"chart": {
"renderTo": "w0",
"type": "bar"
},
"credits": {
"enabled": false
},
"title": "Timeline content count monthly",
"xAxis": {
"categories": ["Aug 2016"],
"title": false
},
"yAxis": {
"min": 0,
"endOnTick": false,
"allowDecimals": false,
"title": {
"text": "Counts",
"align": "high"
},
"labels": {
"overflow": "justify"
}
},
"plotOptions": {
"bar": {
"dataLabels": {
"enabled": true
}
},
"series": {
"cursor": "pointer",
"point": {
"events": {
"click": "function(){console.log(1); }"
}
}
}
},
"series": [{
"name": "1st Week",
"data": [1]
}, {
"name": "2nd Week",
"data": [4]
}, {
"name": "3rd Week",
"data": [7]
}, {
"name": "4th Week",
"data": [0]
}, {
"name": "5th Week",
"data": [0]
}]
});
Here the data should be generated using an active dataprovider. I think this will not effect. May be it is a Js issue. libraries are also included correctly. chart is also plotting perfect. only the problem is that whenever I am going to click on point it shows an error.
Thanks.
You have this:
"click": "function(){console.log(1); }"
Should be like this
"click": function() {
console.log(1);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.