PDA

View Full Version : Chart item fill function


kminev
08-25-2008, 10:38 PM
I need to exclude all the data point that have zero and not plot them. Can I do that in my fill function maybe exit the function????

Here is my fill function:


private function myFillFunction(element:ChartItem, index:Number):IFill {

var item:PlotSeriesItem = PlotSeriesItem(element);
var hitObj:HitData = new HitData(0, 0, item.x, item.y, element);

/*
switch(hitObj.item.A)
{
case "Add":
return green;
case "Delete":
return red;
case "Change":
return yellow;
default:
return null;
}
*/

if(wtog.selected == true)
{
trace("ACTION: " + hitObj.item.A + " W2G: " + hitObj.item.W2G);
switch(hitObj.item.A)
{
case "Add":
if(hitObj.item.W2G > 0)
{
return green;
}
else
{
return null;
}
case "Delete":
if(hitObj.item.W2G > 0)
{
return red;
}
else
{
return null;
}
case "Change":
if(hitObj.item.W2G > 0)
{
return yellow;
}
else
{
return null;
}
default:
return null;
}

}



Thanks in advnace

rawmantick
08-26-2008, 11:08 AM
Yeh, you can return from function. Or simply like
if( point i dont like and dont want to draw )
return null;
Or did not I understood the problem?:confused:

kminev
08-26-2008, 04:07 PM
Yes, but once I return null if I don't like the statement than it uses the default color and still plots my data points.

rawmantick
08-26-2008, 05:48 PM
Then read about IFill interface... You can implement it easily, leaving it's drawing functions empty.