Uncaught TypeError: fn.call is not a function

javascript jquery highcharts

3242 просмотра

1 ответ

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

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.

Автор: Ansari Khalid Источник Размещён: 08.11.2019 11:19

Ответы (1)


1 плюс

Решение

You have this:

"click": "function(){console.log(1); }"

Should be like this

"click": function() { 
  console.log(1); 
}
Автор: Bruno Campos Размещён: 20.08.2016 12:45
Вопросы из категории :
32x32