Flex mx:Legend在它的容器外涂料

时间:2013-01-30 16:03:21

标签: actionscript-3 flex flex3

我有一个带图例的图表

<s:VGroup  width="100%" height="100%">

        <mx:LineChart width="100%" height="100%" id="lineChart" showDataTips="true" dataTipFunction="columnChartDataTipFunction">
            <mx:verticalAxis>
                <mx:LinearAxis id="v1" title="Position" labelFunction="labelFuncY"/>
            </mx:verticalAxis>
            <mx:horizontalAxis>
                <mx:CategoryAxis
                    categoryField="kh_formatted_date" />
            </mx:horizontalAxis>
            <mx:verticalAxisRenderers>                
                <mx:AxisRenderer id="vax" axis="{v1}" placement="top"/>
            </mx:verticalAxisRenderers>
        </mx:LineChart>

        <s:BorderContainer width="100%" borderColor="#ff0000" borderWeight="4">

        <mx:Legend verticalGap="0" dataProvider="{lineChart}" clipContent="true" maxWidth="100"/>
        </s:BorderContainer>
    </s:VGroup>

我有这个结果,但我期待滚动条,同样maxWidth似乎被忽略了。 enter image description here

1 个答案:

答案 0 :(得分:1)

使用此结构

    <s:BorderContainer width="100" borderColor="#ff0000" borderWeight="4">

        <s:Scroller left="0" right="0" top="0" bottom="0">
            <s:Group left="0" right="0" top="0" bottom="0">
                <mx:Legend verticalGap="0" dataProvider="{myChart}" clipContent="true"/>
            </s:Group>
        </s:Scroller>

    </s:BorderContainer>

控制图例的宽度,您可以使用BorderContainer的width属性

enter image description here