在应用中需要用到屏幕坐标系下的Chart,网上查询了很久都没有找到相关的资料。后来无奈之下仔细看了Chart的API 发现要实现这个功能其实很简单。(API是个好东西~)
需求如下图, 图表应该一这种方式展示出来,而默认的是X轴在下面,我需要把它移到顶部去。
新建一个horizontalAxisRenderers来进行设置, 只要AxisRenderer的placement设置为top即可!! 真简单~
横轴可以设置top或bottom 纵轴可以设置left 或right
<mx:horizontalAxis>
<mx:LinearAxis id="haxis" baseAtZero="false" title="{dataType}" />
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="false" title="深度(m)" labelFunction="verAxis_labelFunc"/>
</mx:verticalAxis>
<mx:horizontalAxisRenderers>
<mx:AxisRenderer axis="{haxis}" canDropLabels="true" placement="top"/>
</mx:horizontalAxisRenderers>
效果图