如何在flex中显示多行的图例

时间:2011-10-28 14:20:04

标签: actionscript-3 flex flex4 flex4.5

我有一个带有12个传奇的折线图。因此,最终会被截断,而不是因为缺乏空间而缠绕在一起。任何人都可以建议我一种方法来显示下一行的剩余传说。例如每个ln上的6个传说

2 个答案:

答案 0 :(得分:0)

您也可以使用LegendItems和LegendMarkerRenderer创建自定义图例。这样你就可以把它们放在你想要的任何地方,也可以放在你想要的任何布局上然后,您可以将图例封装在VGroup,或HGroup或具有TileLayout的组中,或者其他任何内容,绝对放置每个。 e.g。

<mx:Legend>
                    <mx:LegendItem label="January" fontWeight="bold">

                        <mx:fill>
                            <mx:SolidColor color="#0FFF3C" alpha=".9"/>
                        </mx:fill>
                        <mx:stroke>
                            <mx:SolidColorStroke color="#0FFF3C" weight="1"/>
                        </mx:stroke>
                    </mx:LegendItem>
                    <mx:LegendItem label="February" fontWeight="bold">
                        <mx:legendMarkerRenderer>
                            <fx:Component>
                                <mx:CircleItemRenderer/>
                            </fx:Component>
                        </mx:legendMarkerRenderer>
                        <mx:fill>
                            <mx:SolidColor color="#FF8F35" alpha=".8"/>
                        </mx:fill>
                        <mx:stroke>
                            <mx:SolidColorStroke color="#35ABFF" weight="3"/>
                        </mx:stroke>
                    </mx:LegendItem>
                </mx:Legend>

答案 1 :(得分:0)

如果图表ID是&#39; myChart&#39;和系列ID是&#39; chartSer&#39;然后:

private function init():void {
  this.myChart.addEventListener(FlexEvent.UPDATE_COMPLETE, updEvHandler);
}

private function updEvHandler(ev:Event):void{
  chartSer.displayName = "Line 1"+String.fromCharCode(13)+"Line 2";
}