Sorry, I meant to follow up on this yesterday. Thanks for your reply but I figured it out. I had the wrong type of horizontal axis applied so when I was returning an xField value it was actually drawing the chart off to the right somewhere.
Jake Churchill CF Webtools 11204 Davenport, Ste. 100 Omaha, NE 68154 http://www.cfwebtools.com 402-408-3733 x103 -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Sam Lai Sent: Friday, June 12, 2009 9:27 AM To: [email protected] Subject: Re: [flexcoders] Charting dataFunction issues Can you try removing some of those series to isolate the problem? Also, can we see the console output from the trace statements in seriesDataFunction? Maybe the values are out of bounds? Some sample data would be useful too if that's possible. 2009/6/12 Jake Churchill <[email protected]>: > > > Charting people, please help! > > > > Im using examples right out of Adobes guides and several other guides Ive > found online on how to use a series dataFunction. The issue is that when I > try to use the dataFunction, I get nothing. The Series doesnt display at > all. When I go back to using yField, everything is fine. Below is the MXML > for the chart and series. The dataprovider is an ArrayCollection of VOs > with the following properties: > > > > public var ceiling:Number; > > public var costOfProd:Number; > > public var cropProfileID:Number; > > public var floor:Number; > > public var historyDt:Date; > > public var insGuarantee:Number; > > public var revenue:Number; > > > > Here is the dataFunction that Im using (straight out of an example from > http://flexdiary.blogspot.com/2008/08/charting-example.html) which I changed > to work with my data: > > > > public function seriesDataFunction( series:Series, > item:UserRevenueHistoryVO, fieldName:String ):Object > > { > > var returnValue:Object = null; > > switch( fieldName ) > > { > > case "xValue": > > returnValue = > item.historyDt; > > break; > > case "yValue": > > returnValue = 250000; > > break; > > case "minValue": > > returnValue = item.ceiling; > > break; > > } > > trace(fieldName + " " + returnValue); > > > > return returnValue; > > } > > > > Finally, heres the chart code. The Line Series work fine because Im using > yField. If I switch the AreaSeries to yField instead of dataFunction, they > work as well but I need to do some work with the ceiling data in this case. > > > > <mx:CartesianChart > > > id > = "chart" > > > width > = "100%" > > > height > = "100%" > > > showDataTips > = "true" > > > dataProvider > = "{Model.instance.acUserRevenueHistory}" > > > > > <mx:series> > > <mx:AreaSeries > > > id = > "floorSeries" > > > showDataEffect = "{seriesEffect}" > > > displayName = "Floor" > > > form = "step" > > > dataFunction = "dataFunc" > > > > > > <mx:areaStroke> > > > <mx:Stroke > > > weight = "1" > > > alpha = "100" > > > color = "0x000000" > > > /> > > > </mx:areaStroke> > > > <mx:areaFill> > > <mx:SolidColor > > color="0xE9E4C7" > > alpha="1" > > /> > > </mx:areaFill> > > > > </mx:AreaSeries> > > <mx:LineSeries > > > id = > "revenueSeries" > > > showDataEffect = "{seriesEffect}" > > > displayName = "Actual Revenue" > > > form = "curve" > > > yField = "revenue" > > > > > > <mx:lineStroke> > > > <mx:Stroke > > > weight = "2" > > > alpha = "100" > > > color = "0x000000" > > > /> > > > </mx:lineStroke> > > </mx:LineSeries> > > <mx:LineSeries > > > id = > "costOfProductionSeries" > > > showDataEffect = "{seriesEffect}" > > > displayName = "Cost of Production" > > > yField = "costOfProd" > > > > > > <mx:lineStroke> > > > <mx:Stroke > > > weight = "1" > > > alpha = "100" > > > color = "0x000000" > > > /> > > > </mx:lineStroke> > > </mx:LineSeries> > > <mx:LineSeries > > > id = > "insuranceGuaranteeSeries" > > > showDataEffect = "{seriesEffect}" > > > displayName = "Insurance Guarantee" > > > yField = "insGuarantee" > > > > > > <mx:lineStroke> > > > <mx:Stroke > > > weight = "1" > > > alpha = "100" > > > color = "0x000000" > > > /> > > > </mx:lineStroke> > > </mx:LineSeries> > > <mx:AreaSeries > > > id = > "ceilingSeries" > > > showDataEffect = "{seriesEffect}" > > > displayName = "Ceiling" > > > form = "step" > > > yField = "ceiling" > > > minField = "ceiling" > > > dataFunction = "seriesDataFunction" > > > > > > <mx:areaStroke> > > > <mx:Stroke > > > weight = "1" > > > alpha = "100" > > > color = "0x000000" > > > /> > > > </mx:areaStroke> > > > <mx:areaFill> > > > <mx:SolidColor color="0xD8E0ED" alpha="1" /> > > > </mx:areaFill> > > </mx:AreaSeries> > > </mx:series> > > </mx:CartesianChart> > > > > Jake Churchill > CF Webtools > 11204 Davenport, Ste. 100 > Omaha, NE 68154 > http://www.cfwebtools.com > 402-408-3733 x103 > > ------------------------------------ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62 079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.63/2169 - Release Date: 06/12/09 05:55:00

