Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Got "Cannot read property 'apply' of null" error on line 634

Open artchen opened this issue 12 years ago • 4 comments

Hello, I am using Chart.js for a website project. It works almost perfectly except a Javascript "Cannot read property 'apply' of null" error on line 634 (uncompressed version of Chart.js). The error doesn't have visible influence on the performance of the plugin, but it never disappears in the console when I inspected element in Google Chrome.

Does anyone have know how to avoid this error?

artchen avatar Jul 21 '14 14:07 artchen

For some reason your onAnimationComplete is null.

Are you overwriting this in the config?

nnnick avatar Jul 21 '14 15:07 nnnick

No, I didn't. Here are my global configurations:

        Chart.defaults.global.tooltipTitleFontSize = 13;
        Chart.defaults.global.tooltipFontSize = 13;
        Chart.defaults.global.tooltipYPadding = 10;
        Chart.defaults.global.tooltipXPadding = 10;
        Chart.defaults.global.tooltipCornerRadius = 5;
        Chart.defaults.global.tooltipTemplate = "<%if (label){%><%=label%><%}%>";

and my configurations for the bar chart:

var options_weather = {
        responsive:true,
        scaleOverride:true,
        scaleSteps:6,
        scaleStepWidth:5,
        scaleStartValue: 0,
        scaleBeginAtZero : true,
        scaleShowGridLines : true,
        scaleGridLineColor : "rgba(0,0,0,.05)",
        scaleGridLineWidth : 1,
        barShowStroke : true,
        barStrokeWidth : 2,
        barValueSpacing : 5,
        barDatasetSpacing : 2
    }

artchen avatar Jul 30 '14 14:07 artchen

Think you could create a jsbin showing this problem happening?

nnnick avatar Jul 30 '14 15:07 nnnick

Actually I did make the function null around some corner intendedly... orz. Problem solved. Thank you very much.

artchen avatar Aug 27 '14 15:08 artchen