1. 程式人生 > >linechart自定義y軸座標

linechart自定義y軸座標

設定y軸精度為2的數字
1、xml檔案裡面,加入labelFunction方法,linearAxis_labelFunc
        <!-- vertical axis -->
        <mx:verticalAxis>
            <mx:LinearAxis baseAtZero="false"
                    title="Price"
                    labelFunction="linearAxis_labelFunc" />
        </mx:verticalAxis>
 
<mx:CurrencyFormatter id="currFormatter" precision="2" />
2、as中加入
    private function linearAxis_labelFunc(item:Object, prevValue:Object, axis:IAxis):String {
         return currFormatter.format(item);
       }

x軸中加入和這個類似