Search code examples
javascriptjqueryjqplot

Uncaught TypeError: Cannot read property 'emptyForce' of undefined ( Jqplot )


On orientation change event of phone i replot the graphic:

$( window ).on( "orientationchange", function( event ) {
    $('#flot-chart-line-cumul-sales').empty();
    setTimeout(function() {                                    
        plotLineSales.replot({resetAxes:true});
    }, 200);
}

jqplot launch this error in console in the file jqplot.pointLabels.min.js at this point t._elems[w].emptyForce():

Uncaught TypeError: Cannot read property 'emptyForce' of undefined

FYI: maybe can help, this is the point label code of jqplot:

    series:[
            {
                label:'Open + Closed', 
                color:' #4BB2C5',
                pointLabels:
                {
                    show:true,
                    ypadding: 7,
                    stackedValue: false,
                    hideZeros: false,
                    formatString:'%d',
                    escapeHTML:false
                }
            },
            {   
                label:'Closed', 
                color:' #EAA228',
                pointLabels:
                {
                    show:true,
                    ypadding: -25,
                    stackedValue: false,
                    hideZeros: false,
                    formatString:'%d',
                    escapeHTML:false
                }
            },

        ],

anyone can help me?


Solution

  • This quick fix work.

    In jqplot.pointLabels.min.js i have changed

    t._elems[w].emptyForce()

    with

    if(t._elems[w]) t._elems[w].emptyForce();