2 Replies Latest reply on Jun 2, 2009 12:24 AM by Magick9393

    How to make a long Legend contained in multiple line

    glen08 Level 1
      I have a PieChart needs legends. Some of them are very long. Is it possible to make long legends written in
      multiple lines? Here is the code for the PieChart and Legend:

      <mx:PieChart id="byMake" height="325" width="100%"
      dataProvider="{make.product}" showDataTips="true" >
      <mx:series>
      <mx:PieSeries field="quantity" nameField="brand" startAngle="0" />
      </mx:series>
      </mx:PieChart>
      <mx:Legend dataProvider="{byMake}" horizontalAlign="left" />
        • 1. Re: How to make a Legend contains multiple line
          Level 7

          "glen08" <webforumsuser@macromedia.com> wrote in message
          news:giem8i$e0j$1@forums.macromedia.com...
          >I have a PieChart needs legends. Some of them are very long. Is it possible
          >to
          > make long legends written in
          > multiple lines? Here is the code for the PieChart and Legend:
          >
          > <mx:PieChart id="byMake" height="325" width="100%"
          > dataProvider="{make.product}" showDataTips="true" >
          > <mx:series>
          > <mx:PieSeries field="quantity" nameField="brand" startAngle="0" />
          > </mx:series>
          > </mx:PieChart>
          > <mx:Legend dataProvider="{byMake}" horizontalAlign="left" />

          Try this as your itemRenderer

          package com.magnoliamultimedia.views
          {
          import flash.display.DisplayObject;

          import mx.charts.LegendItem;
          import mx.core.UITextField;

          public class WrappingLegendItem extends LegendItem
          {
          public function WrappingLegendItem()
          {
          super();
          }
          override protected function createChildren():void{
          super.createChildren();
          for (var i:int=0;i<numChildren; i++){
          var child:DisplayObject=getChildAt(i);
          var txt:UITextField = child as UITextField;
          if (!(txt==null)){
          txt.wordWrap=true;
          txt.invalidateSize();
          }
          }
          }
          }
          }


          • 2. Re: How to make a long Legend contained in multiple line
            Magick9393 Level 1

            Hi

             

            did anyone manage to get this to work? I have been battling this issue for a long time now and am not making any progress.

             

            You can see some of the things I have tried here: http://forums.adobe.com/message/2005497#2005497

             

            If anyone knows how to do this I would be extremely appreciative.