0

我有使用 Jquery Ui 创建的动态选项卡。我想向由 Jquery ui 创建的 div 添加一个高图表。当我将此 id 传递给 Highchart 选项的“renderTo”时,它会显示错误 #13。我已经查找过它,根据它,Highcharts 找不到 Div。

所以有什么建议我可以解决这个问题..?

function miniG_help()
{

    $("#tab_container").tabs("add","#tabs-1","123");
         $( "#tab_container" ).tabs( "refresh" );
    plotGraph(url_temp,"#tabs-1");  
}

function plotGraph(url,divId)
{
..................
options.chart={renderTo: divId};
}
4

1 回答 1

0

This error occurs because the div hasn't been written to the dom yet, and does not exist when you try to create the chart. Make sure your element is written to the page before creating the chart.

One suggestion would be to call the method to create the chart on load of the tabs. There is a "load" event you can tie this to (http://api.jqueryui.com/tabs/#event-load):

$( ".selector" ).tabs({
    load: function( event, ui ) {
        //call method to create chart now
    }
});
于 2013-02-08T05:22:51.353 回答