Hi there,

I'm currently using a flex chart with 2 lineseries. I specified for each
of them a custom itemrenderer.
Here is the simplified code that I'm using :

package myrenderers
{

public class MyRenderer extends ProgrammaticSkin  implements
IDataRenderer
{
private var _chartItem:LineSeriesItem;

public function MyRenderer()
{
}

public function get data():Object
{
return _chartItem;
}

public function set data(value:Object):void
{
if (_chartItem == value)
return;

_chartItem = value as LineSeriesItem;

//invalidateDisplayList();
}


override protected function
updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
var g:Graphics = graphics;
g.clear();

//Some code to retrieve the proper size/positioning/color wanted

// Draw a grey circle
g.beginFill(0xBABABA, 1.0);
g.drawCircle(positionUsed, positionUsed, radiusUsed+1);
g.endFill();

//Other drawing routines, to create the wanted shape
....................
.....................................
...................................
}//End of updateDisplayList function
}
}

All works fine until I reach the amount of 100 points on each series,
where the rendering becomes a little choppy, especially since we are
using an animation whenever the dataprovider of each series is updated.
So in order to optimize the rendering, I was thinking of 2 different
solutions.
1.Have our designer give me a swf that would simply be a vectorial image
and then add this swf within the updatedisplaylist of my itemrenderer.
2. Run the drawing code only once at the beginning of my app, save it in
a shape and reuse that shape in the updatedisplaylist of my itemrenderer
instead of redrawing each time the same thing.

I'd like to get some of your input,which solution would be better to
lighten the work load of the flashplayer, and also if I should make my
renderer derive this way:
public class MyRenderer extends mx.skins.ProgrammaticSkin  implements
IDataRenderer

or another.

Thanks a lot in advance for your input.

Joss.

Reply via email to