设置Legend的字体大小
直接设置 Legend的fontSize是没有用的。
可以通过扩展LegendItem类,并设置Legend的ItemClass属性来实现。
package{
import mx.charts.LegendItem;
public class BigFontLegendItem extends LegendItem{
public function BigLegendItem(){
super();
this.styleName="ChineseFont";
}
}
}
//application中:
<mx:Style>
.ChineseFont{
fontFamily:"Verdana","宋体";
fontSize:12;
}
</mx:Style>
<mx:Legend legendItemClass="LinkLegendItem"/>
也可以通过派生这个类, 就可以修改其相应的样式.
派生LegendItem 类, 并设置样式.
BigFontLegendIte.as
view plaincopy to clipboardprint?
package com
{
import mx.charts.LegendItem;
public class BigFontLegendItem extends LegendItem
{
public function BigFontLegendItem()
{
super();
this.styleName = "<STRONG>ChineseFont</STRONG>";
}
}
}
package com
{
import mx.charts.LegendItem;
public class BigFontLegendItem extends LegendItem
{
public function BigFontLegendItem()
{
super();
this.styleName = "<STRONG>ChineseFont</STRONG>
";
}
}
}
2. 然后定义样式, 在 Legend 中直接指定legendItemClass 为 BigFontLegendIte
view plaincopy to clipboardprint?
<mx:Style>
.<STRONG>ChineseFont</STRONG>
{
fontFamily:"Verdana","宋体";
fontSize:12;
}
</mx:Style>
<mx:Legend legendItemClass="com.BigFontLegendItem " />
<mx:Style>
.<STRONG>ChineseFont</STRONG>
{
fontFamily:"Verdana","宋体";
fontSize:12;
}
</mx:Style>
<mx:Legend legendItemClass="com.BigFontLegendItem " />
这样就可以设置Legend 中的字体大小或者样式了.
在flex chart中使用带链接的Legend