Firefox SDK:包括jquery.flot在内的问题,错误显示维度高度为空

firefox sdk: problems including jquery.flot, error says dimension height null

本文关键字:显示 错误 高度 问题 包括 SDK jquery flot Firefox      更新时间:2023-09-26

所以我正在使用jQuery.flot库,我得到了这个Invalid dimensions for plot, widht = 700, height = 0错误。所以我尝试在做绘图之前在javascript中设置高度,我得到了一个新的错误options is null

有谁知道这是什么来源?

这是我的main.js

tabs.open({
    url: "./stats.html",
    onReady: function(tab) {
        tab.attach({
            contentScriptFile: [
                "./jquery-2.1.3.min.js",
                "./jquery.flot.min.js",
                "./jquery.flot.pie.min.js",
                "./scripts.js"
            ],
            contentScriptOptions: {
                'logs': ss.storage.logs
            }
        })
    }
})

在我的script.js

$('#today_pie').width('100%').height('500px')
$.plot('#today_pie', data, {
    series: {
        pie: {
            innerRadius: 0.5,
            show: true
        }
    }
});

如果有人遇到同样的问题。我通过切换到图表解决了它.js:https://github.com/nnnick/Chart.js

它在HTML5中使用Canvas,所以也许这就是它工作的原因。