AxisRenderer 的 labelRotation 属性不做任何事情 [英] AxisRenderer's labelRotation property doesn't do anything
问题描述
尽管在此柱形图中将 labelRotation 属性设置为 90,但轴标签是水平的.我还有什么需要做的吗?
Despite setting the labelRotation property to 90 in this column chart, the axis labels are horizontal. Is there something additional I need to do?
<mx:ColumnChart id="myChart" height="100%" width="100%"
dataProvider="{myData}"
showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis id="h1" categoryField="code"/>
</mx:horizontalAxis>
<mx:horizontalAxisRenderers>
<mx:AxisRenderer axis="{h1}" labelRotation="90" />
</mx:horizontalAxisRenderers>
<mx:series>
<mx:ColumnSet type="stacked"
allowNegativeForStacked="true">
<mx:series>
<mx:ColumnSeries xField="code"
yField="A"
displayName="A"/>
<mx:ColumnSeries xField="code"
yField="B"
displayName="B"/>
<mx:ColumnSeries xField="code"
yField="C"
displayName="C"/>
<mx:ColumnSeries xField="code"
yField="D"
displayName="D"/>
<mx:ColumnSeries xField="code"
yField="F"
displayName="F"/>
</mx:series>
</mx:ColumnSet>
</mx:series>
</mx:ColumnChart>
我尝试按照 Amy 和 fotomut 的建议嵌入字体,但它没有做任何事情:
I tried embedding the font, as suggested by Amy and fotomut, but it didn't do anything:
<mx:Style>
@font-face
{
src:url("../assets/fonts/FRABK.ttf");
fontFamily: myFontFamily;
embedAsCFF: false;
}
ColumnChart
{
fontFamily: myFontFamily;
fontSize: 10;
}
</mx:Style>
推荐答案
使 labelRotation 工作的关键是嵌入字体.有一篇关于 Flex 4.6 的好文章这里
The key to making the labelRotation work is embedding of fonts. There is a good article on Flex 4.6 here
一个简单的代码示例是向 mxml 文件添加样式,
A simple code example would be to add a style to the mxml file,
<fx:Style>
@namespace mx "library://ns.adobe.com/flex/mx";
@font-face{
src: local("Arial");
fontFamily: Arial;
embedAsCFF: false;
}
mx|ColumnChart {
fontFamily: Arial;
fontSize: 10;
}
</fx:Style>
<小时>
我确认这对我使用 Flex 3.5 有效,只需将 fx:Style
更改为 mx:Style
<mx:Style>
@namespace mx "library://ns.adobe.com/flex/mx";
@font-face{
src: local("Arial");
fontFamily: Arial;
embedAsCFF: false;
}
mx|ColumnChart {
fontFamily: Arial;
fontSize: 10;
}
</mx:Style>
也许您应该先尝试像这样嵌入 Arial,看看是否可行?
Perhaps you should try embedding Arial like this first to see if that works?
这篇关于AxisRenderer 的 labelRotation 属性不做任何事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!