I have tried your tip with the first label. The label is placed correctly (I
traced its x and y values) but it's not showing up. The updated class:
package com
{
import mx.controls.Label;
import mx.core.IDataRenderer;
import mx.core.UIComponent;
import mx.events.FlexEvent;
public class CustomLabelRenderer extends UIComponent implements
IDataRenderer
{
private var _data:Object;
private var _labelYear:Label;
public function CustomLabelRenderer()
{
super();
}
[Bindable("dataChange")]
public function get data():Object
{
return _data;
}
override protected function createChildren():void
{
super.createChildren();
_labelYear = new Label();
addChild(_labelYear);
}
public function set data(value:Object):void
{
_data = value;
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
if(value != null)
{
_labelYear.text = String(value.text);
}
}
}
}
--- In [email protected], thomas parquier <mailingli...@...> wrote:
>
> I think your renderer should extend a uicomponent by adding to labels
> components within.
>
> ---
> thomas parquier
> http://www.web-attitude.fr/realisations/
> msn : thomas.parqu...@...
> softphone : sip:webattit...@... <sip%3awebattit...@...>
> téléphone portable : +33601 822 056
>
>
> 2010/4/13 pullzmag <deegregg_ml...@...>
>
> >
> >
> > The first one is the default one. The second one is retrieved from an
> > array. So I have no problem with retrieving their values but having
> > displayed the second one. I have been using the below class, assigned as
> > labelRenderer
> >
> > package com
> > {
> > import mx.charts.AxisLabel;
> > import mx.controls.Label;
> > import mx.core.IDataRenderer;
> >
> > public class CustomLabelRenderer extends Label implements IDataRenderer
> > {
> > private var _data:AxisLabel;
> >
> > public function CustomLabelRenderer()
> > {
> > super();
> > }
> >
> > override public function get data():Object
> > {
> > return _data;
> > }
> >
> > override public function set data(value:Object):void
> > {
> > if(value != null)
> > {
> > this._data = value as AxisLabel;
> > this.text = String(value.text);
> > }
> > }
> > }
> > }
> >
> > Basically, the above class does nothing special. It just displays the same
> > label as in case where no labelRenderer is defined. I was trying to add to
> > this class another label for storing the second value but that label was not
> > displayed at all (whether by adding as a child to the first label or to the
> > axis renderer).
> >
> >
> > --- In [email protected] <flexcoders%40yahoogroups.com>, thomas
> > parquier <mailinglists@> wrote:
> > >
> > > where do you take labels from ?
> > >
> > > thomas parquier
> > > ---
> > > http://www.web-attitude.fr/realisations/
> > > msn : thomas.parquier@
> > > softphone : sip:webattitude@ <sip%3Awebattitude@>
> > > téléphone portable : +33601 822 056
> > >
> > >
> > > 2010/4/13 pullzmag <deegregg_mlist@>
> > >
> > > >
> > > >
> > > > Any ideas guys?
> > > >
> > > >
> > > > --- In [email protected]
> > > > <flexcoders%40yahoogroups.com><flexcoders%
> > 40yahoogroups.com>,
> >
> > > > "pullzmag" <deegregg_mlist@> wrote:
> > > > >
> > > > > For my line chart I need a "label" which will be made of two labels.
> > I
> > > > was trying to use custom labelRenderer where I added another label but
> > this
> > > > either not possible or I did something wrong. Can you give me some tips
> > for
> > > > doing this in a right way?
> > > > >
> > > > > Thanks!
> > > > > G.
> > > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
>