2012-03-21 16 views
-1

私はhttp://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/portal/portal.htmlのようにポータルを開発しています。私は2つの項目を持つパネルを示す次のコードを開発しました。それらの高さと幅は自動的に調整されます。しかし、私がしたいのは、それらを連続して立てることです。現在、2番目の項目は最初の項目の下に配置されています。私はvboxをhboxに置き換えましたが、グラフは消えました。助けてください....extJs(Hboxの問題)

あなたの助けはあなたが表示されたコードは、それぞれ他の下に配置されるアイテムを意味整列ストレッチでのVBoxを使用しています

Ext.define("Ext.app.ChartPortlet", {extend:"Ext.panel.Panel",alias:"widget.chartportlet",requires: ["Ext.data.JsonStore","Ext.chart.theme.Base","Ext.chart.series.Series","Ext.chart.series.Li  ne","Ext.chart.axis.Numeric"], 
    generateData:function(){var b=[{name:"x",djia:10000,sp500:1100}],a;for(a=1;a<50;a++) {b.push({name:"x"+a,sp500:b[a-1].sp500+ ((Math.floor(Math.random()*2)%2)?-1:1)*Math.floor(Math.random()*7),djia:b[a-1].djia+  ((Math.floor(Math.random()*2)%2)?-1:1)*Math.floor(Math.random()*7)})}return b} 
    ,initComponent:function() 
    {Ext.apply(this,{layout: { 
    type: 'vbox', 
     align: 'stretch' 
    } 
    ,width:600,height:300,items: 
    [{xtype:"chart",animate:false,shadow:false,store:Ext.create("Ext.data.JsonStore", 
    {fields:["name","sp500","djia"],data:this.generateData()}),legend:   {position:"bottom"},axes:[{type:"Numeric",position:"left",fields:["djia"], 
    title:"Dow Jones Average",label:{font:"11px Arial"}}, {type:"Numeric",position:"right",grid:false,fields:["sp500"],title:"S&P 500",label: {font:"11px Arial"}}], 
    series:[{type:"line",lineWidth:1,showMarkers:false,fill:true,axis: ["left","bottom"],xField:"name",yField:"djia",style:{"stroke-width":1}},  {type:"line",lineWidth:1,showMarkers:false, 
    axis:["right","bottom"],xField:"name",yField:"sp500",style:{"stroke-width":1}}]}] 


     });this.callParent(arguments)}}); 

答えて

0

認識されます。アライメントストレッチは、幅が親コンテナの100%を占めるように、幅を指定しないでください。 投稿された現在のコード:http://jsfiddle.net/dbrin/kcd9g/show/light/ 私は行方不明を修正しました。幅の設定、残りはあなたのものです。