Flex使用AS设置组件width和height的百分比
this.percentWidth = 80;//宽度80%
this.percentHeight = 100;//高度100%
<mx:ColumnChart xmlns:mx="http://www.adobe.com/2006/mxml"
height="100%"
paddingLeft="5"
paddingRight="5"
showDataTips="true"
initialize="setWidth()">
<mx:Script>
<![CDATA[
import com.citi.osm.portal.alert.AlertUtils;
[Bindable]
public var chartWidth:Number;
public function setWidth():void{
this.percentWidth = chartWidth;
}
]]>
</mx:Script>
...
...
</mx:ColumnChart>
<alertchart:AlertChart id="alertChart" chartWidth="100" />
this.percentWidth = 80;//宽度80%
this.percentHeight = 100;//高度100%
<mx:ColumnChart xmlns:mx="http://www.adobe.com/2006/mxml"
height="100%"
paddingLeft="5"
paddingRight="5"
showDataTips="true"
initialize="setWidth()">
<mx:Script>
<![CDATA[
import com.citi.osm.portal.alert.AlertUtils;
[Bindable]
public var chartWidth:Number;
public function setWidth():void{
this.percentWidth = chartWidth;
}
]]>
</mx:Script>
...
...
</mx:ColumnChart>
<alertchart:AlertChart id="alertChart" chartWidth="100" />