Changing Y values in a chart
Here is the updated code:
开发者_Python百科private function myFillFunction(element:ChartItem, index:Number, item:Object,
fieldName:String):IFill {
var c:SolidColor = new SolidColor(0x00CC00);
var ci:ColumnSeriesItem = ColumnSeriesItem(element);
c.color = 0xFF2020;
if ( Number(ci.yValue) >= 0 ) {
c.color = 0x5586E0;
}
if(fieldName == "yValue"){
item.price= Math.abs( item.price);
}
else{
item.date = item.date;
}
return c;
}
I get the following error: ArgumentError: Error #1063: Argument count mismatch on index/myFillFunction(). Expected 4, got 2.
you can get the absolute of a value much easier than what you are attempting by calling the abs() method of the Math class:
Math.abs(value);
however, the error is saying that you are trying to send 3 parameters to your fixNegatives(element:ChartItem) function while it can only receive the one ChartItem object.
精彩评论