加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

修改flex chart中Legend的字体样式

发布时间:2020-12-15 01:42:38 所属栏目:百科 来源:网络整理
导读:修改flex chart中Legend的字体样式 关键字: flex,chart,样式 ? 最近在弄FLEX的图表,发现CHART 中的Legend 的字体通过直接设置Style 并没有办法改变字体大小. google 了下,发现了这个方法: 通过派生LegendItem类,并设置Legend的ItemClass属性来实现。 ? Lege

修改flex chart中Legend的字体样式
关键字: flex,chart,样式
?

最近在弄FLEX的图表,发现CHART 中的Legend 的字体通过直接设置Style 并没有办法改变字体大小.

google 了下,发现了这个方法: 通过派生LegendItem类,并设置Legend的ItemClass属性来实现。

?

LegendItem 是Lengend 的元素,就是里面一个一个的图示. 通过派生这个类,就可以修改其相应的样式.

?

?

?

派生LegendItem 类,并设置样式.
?

BigFontLegendIte.as

?

Actionscript代码
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 = "ChineseFont


";
?? }
?
}
}
?

2. 然后定义样式,在 Legend 中直接指定legendItemClass 为? BigFontLegendIte

?

Xml代码
<mx:Style>?
???? .<STRONG>ChineseFont</STRONG>?
?
?
{??
??????? fontFamily:"Verdana","宋体";??
??????? fontSize:12;??
???? }??
</mx:Style>?
?
<mx:Legend legendItemClass="com.BigFontLegendItem " />?

<mx:Style>
???? .ChineseFont


{
??????? fontFamily:"Verdana","宋体";
??????? fontSize:12;
???? }
</mx:Style>

<mx:Legend legendItemClass="com.BigFontLegendItem " />?
?

这样就可以设置Legend 中的字体大小或者样式了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读