Flex Chart,columnWidthRatio不适用于ColumnChart的LinearAxis

时间:2011-04-13 10:10:45

标签: flash flex actionscript-3 flex-charting

如果我使用的是LinearAxis,则columnChart的列显示得太窄,甚至尝试过columnWidthRatio = 0.95

对于类别轴,这很好 谁能告诉我我在这里做错了什么?

我只想增加此图表上列的宽度。

重现问题的示例:          

    <mx:Script>
        <![CDATA[
            import mx.charts.chartClasses.IAxis;

            private function linearAxis_labelFunc(item:Object, prevValue:Object, axis:IAxis):String {
                return numberFormatter.format(item);
            }
        ]]>
    </mx:Script>

    <mx:NumberFormatter id="numberFormatter" precision="3" />

    <mx:ArrayCollection id="arrColl">
        <mx:source>
            <mx:Array>
                <mx:Object temp="10" count="500" />
                <mx:Object temp="30" count="300"  />
                <mx:Object temp="40" count="100"  />
                <mx:Object temp="70" count="700"  />
                <mx:Object temp="80" count="200"  />
            </mx:Array>
        </mx:source>
    </mx:ArrayCollection>

    <mx:ApplicationControlBar dock="true">
        <mx:Label text="columnWidthRatio:" />
        <mx:HSlider id="slider"
                    minimum="0.1"
                    maximum="0.9"
                    value="0.1"
                    liveDragging="true"
                    snapInterval="0.1"
                    tickInterval="0.1" />
    </mx:ApplicationControlBar>

    <mx:ColumnChart id="columnChart"
                    showDataTips="true"
                    dataProvider="{arrColl}"
                    columnWidthRatio="{slider.value}"
                    width="100%"
                    height="100%">

        <mx:horizontalAxis>
            <mx:LinearAxis baseAtZero="false"
                           minimum="0"
                           maximum="100"
                           interval="20"
                           minorInterval="10"
                           labelFunction="linearAxis_labelFunc" />
        </mx:horizontalAxis>

        <mx:verticalAxis>
            <mx:LinearAxis baseAtZero="false"
                           minimum="100"
                           maximum="1000"
                           labelFunction="linearAxis_labelFunc" />
        </mx:verticalAxis>


        <mx:series>
            <mx:ColumnSeries id="columnSeries"
                             xField="temp"
                             yField="count"
                             displayName="temp" />
        </mx:series>

        <mx:seriesFilters>
            <mx:Array />
        </mx:seriesFilters>

    </mx:ColumnChart>

</mx:Application>

1 个答案:

答案 0 :(得分:-1)

使用Item Renderer完成自己

public class ProcessItemRenderer extends UIComponent implements IDataRenderer