简体   繁体   English

未捕获的类型错误:fn.call 不是函数

[英]Uncaught TypeError: fn.call is not a function

I am using hightchart plugin in Yii2 application.我在 Yii2 应用程序中使用 hightchart 插件。 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.现在,当我想调用一些事件,例如单击系列点时,插件会显示错误 Uncaught TypeError: fn.call is not a function 请帮助我。 My Js code for high chart is like that我的高图 Js 代码是这样的

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.可能是js的问题。 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); 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM