Yeah Matt,

You're correct, you can use whatever RegExp you want.  That was just 
an example that I was using for dates.  The main idea is to insert 
the new line, escape character, in the labelFunction.  I realized 
that I wasn't as clear as I could have been, after I hit send. :)

Thanks,
-TH

--- In flexcoders@yahoogroups.com, "Matt Horn" <[EMAIL PROTECTED]> wrote:
>
> Tim's approach requires that you have a hyphen in your label as it
> replaces that hyphen with a hyphen plus a newline.
> 
> Another approach would be to split the string on spaces, and then 
insert
> a newline at the nth space. The following example puts in a 
newline at
> the fourth occurrence of a space:
> 
>   public function defineLabel(cat:Object, pcat:Object, 
ax:CategoryAxis,
> catItem:Object):String {
>         var a:Array = cat.split(' ');
>         var s:String = "";
>         
>         for (var i:int=0; i<a.length; i++) {
>             s += a[i] + ' '; // reconstruct the label
>             if (i==3) { // insert a newline at the fourth space
>                 s += "\n";
>             }
>         }
>         return s;
>   }
> 
> hth,
> matt horn
> flex docs
> 
> 
> 
> > -----Original Message-----
> > From: flexcoders@yahoogroups.com 
> > [mailto:[EMAIL PROTECTED] On Behalf Of dj
> > Sent: Saturday, November 18, 2006 1:21 PM
> > To: flexcoders@yahoogroups.com
> > Subject: Re: [flexcoders] Re: Ely: How do you wordwrap a 
> > label on a bar chart?
> > 
> > 
> > Tim:
> > 
> > I gave this a shot am I missing something here? Wordrapping 
> > isn't working for me, the text is still cut off.
> > 
> > I appreciate your time in showing me this. Regex is all new 
> > to me, but it's all the rage.
> > 
> > Thanks,
> > Patrick
> > 
> > Tim Hoff wrote:
> > >
> > > Patrick,
> > >
> > > Sorry to highjack your thread. Here's a method to display a 
> > > multi-lined Axis label:
> > >
> > > *labelFunction:
> > > *public function
> > > 
> > wrapLabel
(cat:Object,pcat:Object,ax:CategoryAxis,catItem:Object):Strin
> > > g
> > > {
> > > var pattern:RegExp = /-/;
> > > return cat.replace(pattern, "-\n");
> > > }
> > >
> > > *Axis:*
> > > <mx:horizontalAxis>
> > > <mx:CategoryAxis categoryField="CategoryField" 
> > > labelFunction="wrapLabel"/>
> > > </mx:horizontalAxis>
> > >
> > > This example changes:
> > >
> > > 11/17/06 - 12/16/06
> > >
> > > to
> > >
> > > 11/17/06 -
> > > 12/16/06
> > >
> > > By using regular expresions, you have quite a bit of 
flexibility.
> > >
> > > -TH
> > > __________________________________
> > >
> > > **Tim Hoff
> > > **Cynergy Systems, Inc.
> > > http://www.cynergysystems.com <http://www.cynergysystems.com>  
> > > <http://www.cynergysystems.comoffice/ 
> > > <http://www.cynergysystems.comoffice/> > Office 
> > > <http://www.cynergysystems.comoffice/ 
> > > <http://www.cynergysystems.comoffice/> >: 866-CYNERGY
> > >
> > >
> > > --- In flexcoders@yahoogroups.com 
> > <mailto:flexcoders%40yahoogroups.com> , "Tim Hoff" 
> > <TimHoff@> wrote:
> > > >
> > > >
> > > > Thanks Ely, that makes sense now. I'll give it a try. 
> > Luckily, both 
> > > > series are using the same dataProvider, so I'll have 
> > access to the 
> > > > data property and probably be able to eliminate the 
> > second axis completely.
> > > > Thanks for the tips and the source to your interactive 
calendar 
> > > > component 
> > > > 
> > <http://www.quietlyscheming.com/blog/components/interactive-ca
> lendar/ > 
<http://www.quietlyscheming.com/blog/components/interactive-ca
> lendar/> > .
> > > > Great Stuff!
> > > >
> > > > -TH
> > > >
> > > > --- In flexcoders@yahoogroups.com 
> > > > <mailto:flexcoders%40yahoogroups.com> , "Ely Greenfield" 
egreenfi@
> > > > wrote:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Hi Tim. yes, the AxisRenderer supports a property called 
> > > > > 'labelRenderer' which is very much like an item 
> > renderer. Pass the 
> > > > > AxisRenderer a reference to a class (wrapped in a 
classFactory, 
> > > > > just
> > > > as
> > > > > with itemRenderers) that extends UIComponent, 
> > ProgrammaticSkin, or 
> > > > > one of the existing Flex components, and implements the 
> > > > > IDataRenderer interface. The AxisRenderer will 
> > instantiate one of 
> > > > > these for each label it needs to show, and assign the 
> > label to the 
> > > > > labelRenderer's 'data' property.
> > > > >
> > > > > I don't think there are any examples out there of how to 
do this
> > > > today.
> > > > >
> > > > > Ely.
> > > > >
> > > > >
> > > > > p.s. You could also consider writing a custom 
> > > > > axisRenderer...there's a pretty exhaustive example of how 
to do 
> > > > > that in the Interactive Bubble Chart on my blog, 
> > > > > http://www.quietlyscheming.com/. 
> > > > > <http://www.quietlyscheming.com/.>  You could 
> > theoretically create 
> > > > > two axis renderers that stack on the left hand
> > > > side
> > > > > that way, although that's a pretty big undertaking.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > >
> > > > > From: flexcoders@yahoogroups.com 
> > > > > <mailto:flexcoders%40yahoogroups.com>  
> > > > > [mailto:flexcoders@yahoogroups.com 
> > > > > <mailto:flexcoders%40yahoogroups.com> ]
> > > > On
> > > > > Behalf Of Tim Hoff
> > > > > Sent: Friday, November 17, 2006 3:37 PM
> > > > > To: flexcoders@yahoogroups.com 
> > > > > <mailto:flexcoders%40yahoogroups.com>
> > > > > Subject: [flexcoders] Re: Ely: How do you wordwrap a label 
on a 
> > > > > bar chart?
> > > > >
> > > > >
> > > > >
> > > > > Hi Ely,
> > > > >
> > > > > I got this far with wordwrapping the label text, but my 
> > question 
> > > > > is more complicated. I want to have two 
verticalAxisRenderers, 
> > > > > side-by- side, on the same side of a ColumnChart. Or, 
create a 
> > > > > single LabelRenderer to simulate this. One of the 
> > labels needs a 
> > > > > shaded background with text, while the other is just 
> > text. While 
> > > > > digging into it, the docs say to use IFactory for a chart 
> > > > > LabelRenderer. Is this similar to an ItemRenderer for a 
> > DataGrid? 
> > > > > Understandably, there aren't any examples yet that show 
> > how to do this.
> > > > >
> > > > > If you have the time, thanks,
> > > > > -TH
> > > > >
> > > > > --- In flexcoders@yahoogroups.com 
> > > > > <mailto:flexcoders%40yahoogroups.com> , "Ely 
> > Greenfield" egreenfi@
> > > > > wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > Hi Patrick. THe only way would be to use a 
> > labelFunction on your
> > > > axis
> > > > > > and manually insert a line break yourself.
> > > > > >
> > > > > > Ely.
> > > > > >
> > > > > >
> > > > > > ________________________________
> > > > > >
> > > > > > From: flexcoders@yahoogroups.com 
> > > > > > <mailto:flexcoders%40yahoogroups.com>  
> > > > > > [mailto:flexcoders@yahoogroups.com 
> > > > > > <mailto:flexcoders%40yahoogroups.com> ]
> > > > > On
> > > > > > Behalf Of dj
> > > > > > Sent: Friday, November 17, 2006 2:34 PM
> > > > > > To: flexcoders@yahoogroups.com 
> > > > > > <mailto:flexcoders%40yahoogroups.com>
> > > > > > Subject: [flexcoders] Ely: How do you wordwrap a 
> > label on a bar
> > > > chart?
> > > > > >
> > > > > >
> > > > > >
> > > > > > A Vertical Axis why Field, my labels are being cut 
> > off, my width 
> > > > > > dimension is fixed to 280 pixels, so the column needs 
> > to wrap down?
> > > > > >
> > > > > > Thanks,
> > > > > > Patrick
> > > > > >
> > > > >
> > > >
> > >
> > > 
> > 
> > 
> > 
> >  
> >
>


Reply via email to