0

When I'm using jqplot it magically injects the plot into the specified div chart1:

var chart1 = $.jqplot('chart1', weeks , {...

the same is true for ExtJs which injects the created code into the 'info' div:

var testPanel = new Ext.Panel({
    title: "Test",
});
testPanel.render('info');

But how can I plot chart1 into the panel? The following html does not work:

<div id="info">            
    <div id="chart1" class="plot" style="width:400px;height:260px;"></div>
</div>

Also putting the html into extjs does not work because the html of chart1 is null (at this point!?):

var testPanel = new Ext.Panel({
  title: "Test",
  html: $('chart1').html()
});
testPanel.render('info');
4

1 に答える 1

1

パネル インスタンスにリスナーを設定してrenderイベントをリッスンし、チャートをパネルの本体にプロットする必要があります。

http://jsfiddle.net/chrisramakers/ZXDru/

Ext.onReady(function(){

    new Ext.Panel({
        renderTo: Ext.getBody(),
        frame: true,
        title: 'Test panel',
        height: 250,
        listeners: {
            render: function(){

                // this.body.dom is the raw dom object of the body element of this panel
                // render your plot to this.body.dom
                console.log(this.body.dom)
                this.body.update('This is the new content');
            }
        }
    });

});
于 2011-03-11T12:48:05.787 に答える