AxisRenderer的labelRotation属性不执行任何操作 [英] AxisRenderer's labelRotation property doesn't do anything

查看:126
本文介绍了AxisRenderer的labelRotation属性不执行任何操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管在此柱形图中将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>


我通过简单地将fx:Style更改为mx:Style


I confirmed that this works for me using Flex 3.5, by simply changing fx:Style to 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆