我想简化我的代码并将可能的内容添加到css文件中:
<mx:AreaSeries styleName="timeArea" name="A" yField="A" areaStroke="{new Stroke(0x0033CC, 2)}" areaFill="{new SolidColor(0x0033CC, 0.5)}" />
我可以将areaStroke和areaFill移动到css吗?什么是最终的CSS?
感谢
答案 0 :(得分:0)
因此,虽然您无法在css中指定笔划,但您可以指定笔划的属性,即:
<mx:Metadata>
[Style(name="areaFillColor",format="Color",type="Number)]
[Style(name="areaStrokeColor",format="Color",type="Number)]
</mx:Metadata>
<mx:Script>
<![CDATA[
[Bindable]
protected var strokeColor:Number;
[Bindable]
protected var fillColor:Number;
override public function styleChanged(styleProp:String):void{
super.styleChanged(styleProp);
//you really ought to do this in a switch statement
strokeColor = getStyle("areaStrokeColor");
fillColor = getStyle("areaFillColor");
}
]]>
</mx:Script>
<mx:AreaSeries styleName="timeArea" name="A" yField="A" areaStroke="{myStroke}" areaFill="{myFill}" />
<mx:SolidColor id="myFill" color="{fillColor}" alpha=".3"/>
<mx:Stroke id="s1" color="{strokeColor}" weight="2"/>
你的CSS看起来像(myAreaChart是父区域图表上设置的styleName):
.myAreaChart{
areaFillColor: #f3f3f3;
areaStrokeColor: #333333;
}