I am now using e4x as you suggest. I wrote a custom dataTipFunction to display the correct information.
I have tried many things, but I have not been able to get the X - axis labels working. How can I write a custom axis label rendering for the below code ? <?xml version="1.0"?> <!-- charts/HTTPServiceToXMLListCollection.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="srv.send()"> <mx:Script><![CDATA[ import mx.utils.ArrayUtil; ]]></mx:Script> <mx:HTTPService id="srv" url="data.xml" resultFormat="e4x" /> <mx:XMLListCollection id="myAC" source="{srv.lastResult.result}" /> <mx:Panel title="Line Chart"> <mx:LineChart id="chart" dataProvider="{myAC}" showDataTips="true"> <mx:horizontalAxis> <mx:CategoryAxis categoryField="month"/> </mx:horizontalAxis> <mx:series> <mx:LineSeries yField="apple" name="Apple"/> <mx:LineSeries yField="orange" name="Orange"/> <mx:LineSeries yField="banana" name="Banana"/> </mx:series> </mx:LineChart> </mx:Panel> </mx:Application> On Thu, Jul 3, 2008 at 7:41 AM, Stephen More <step.........om> wrote: > On Wed, Jul 2, 2008 at 6:29 PM, Tracy Spratt <tsp.......com> wrote: >> I advise using resultFormat="e4x", a result handler function, and an >> instance variable to hold the xmlResult. > > I started out using e4x until I ran into what I think is a bug: > https://bugs.adobe.com/jira/browse/SDK-15976 > > DataTips in mx:LineChart does not like the e4x format. > > I guess I should go back to using e4x and write a custom > dataTipFunction that actually works. > > > -Steve > > >> The best performance, especially in a multi-renderer DataGrid, will be if >> you manually convert the XML node data ino an ArrayCollection of strongly >> typed value objects. >> >> >> >> Tracy >> >> >> >> ________________________________ >> >> From: [email protected] [mailto:[EMAIL PROTECTED] On >> Behalf Of Sean Clark Hess >> Sent: Wednesday, July 02, 2008 4:05 PM >> To: [email protected] >> Subject: Re: [flexcoders] Inspecting data from HTTPService result to an >> ArrayCollection >> >> >> >> Ah, got it. >> >> The <mx:Model> tag converts everything to a flat object. So the minute you >> use it, you no longer have xml. >> >> It's still easy enough to loop through though. >> >> var result:Object = myData.getItemAt(0); >> for (var name:String in result) >> { >> trace(name + " :: " + result[name]); >> } >> >> should output >> apple :: 81768 >> orange :: 60310 >> banana :: 43357 >> >> On Wed, Jul 2, 2008 at 1:46 PM, Stephen More <[EMAIL PROTECTED]> wrote: >> >> Here is my output: >> >> DEBUG: 2 null >> [object Object] >> CHECK : false >> CHECK : false >> >> Here is all the code: >> <?xml version="1.0"?> >> <!-- charts/XMLFileToArrayCollectionDataProvider.mxml --> >> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >> width="100%" height="100%"> >> <mx:Script> >> import mx.utils.ArrayUtil; >> </mx:Script> >> >> <mx:Model id="results" source="../assets/data.xml"/> >> <mx:ArrayCollection id="myData" >> source="{ArrayUtil.toArray(results.result)}" >> /> >> >> <mx:Panel title="Line Chart"> >> <mx:LineChart id="chart" dataProvider="{myData}" showDataTips="true"> >> <mx:horizontalAxis> >> <mx:CategoryAxis categoryField="month"/> >> </mx:horizontalAxis> >> <mx:series> >> <mx:LineSeries yField="banana" displayName="Banana"/> >> <mx:LineSeries yField="apple" displayName="Apple"/> >> <mx:LineSeries yField="orange" displayName="Orange"/> >> </mx:series> >> </mx:LineChart> >> >> <mx:Button id="iconButton" label="Button with Icon" >> labelPlacement="right" color="#993300" >> click="printMessage(event);"/> >> >> <mx:Script> >> <![CDATA[ >> >> import flash.events.Event; >> >> // Event handler function to print a message >> // describing the selected Button control. >> private function printMessage(event:Event):void { >> //message.text += event.target.label + " pressed" + "\n"; >> >> var myXML:XML; >> myXML = myData.getItemAt(0) as XML; >> >> trace( "DEBUG: " + myData.length + " " + myXML ); >> trace( myData.getItemAt(0) ); >> >> trace("CHECK : " + (myData.getItemAt(0) is XML)); >> >> trace("CHECK : " + (myData.getItemAt(0) is XMLList)); >> } >> >> ]]> >> </mx:Script> >> >> </mx:Panel> >> </mx:Application> >> >> On Wed, Jul 2, 2008 at 3:34 PM, Sean Clark Hess <[EMAIL PROTECTED]> wrote: >>> What do you get when you trace myData.getItemAt(0)? That will return null >>> if it isn't an XML. You can do this too: >>> >>> trace("CHECK : " + (myData.getItemAt(0) is XML)); >>> >>> You can check to see if it is an XMLList too, but I thought looking at it, >>> it seemed like a flat xml. >>> >>> On Wed, Jul 2, 2008 at 1:32 PM, Stephen More <[EMAIL PROTECTED]> >>> wrote: >>>> >>>> Thats what I was thinking but when I try: >>>> >>>> var myXML:XML; >>>> myXML = myData.getItemAt(0) as XML; >>>> trace( "DEBUG: " + myXML ); >>>> >>>> I get >>>> DEBUG: null >>>> >>>> On Wed, Jul 2, 2008 at 2:30 PM, Sean Clark Hess <[EMAIL PROTECTED]> >>>> wrote: >>>> > Each row is an xml object... >>>> > >>>> > So, (myData.getItemAt(i) as XML).children() >>>> > >>>> > Then you could loop through the children and ask them for their name. >>>> > After >>>> > the as XML step you can do anything you can normally do with the XML >>>> > object >>>> > >>>> > On Wed, Jul 2, 2008 at 12:11 PM, Stephen More <[EMAIL PROTECTED]> >>>> > wrote: >>>> >> >>>> >> ( Example code taken from: >>>> >> http://livedocs.adobe.com/flex/201/html/charts_intro_108_12.html ) >>>> >> Here is the dataset I am trying to work with: >>>> >> >>>> >> <data> >>>> >> <result month="Jan-04"> >>>> >> <apple>81768</apple> >>>> >> <orange>60310</orange> >>>> >> <banana>43357</banana> >>>> >> </result> >>>> >> <result month="Feb-04"> >>>> >> <apple>81156</apple> >>>> >> <orange>58883</orange> >>>> >> <banana>49280</banana> >>>> >> </result> >>>> >> </data> >>>> >> >>>> >> The flex code will look like this: >>>> >> <mx:HTTPService >>>> >> id="srv" >>>> >> url="../assets/data.xml" >>>> >> useProxy="false" >>>> >> result="myData=ArrayCollection(srv.lastResult.data.result)" >>>> >> /> >>>> >> >>>> >> How can I interrogate the ArrayCollection named myData so that it will >>>> >> return apple, orange, and banana ? >>>> >> I am not looking to get the numerical values, I want to get the xml >>>> >> name. >>>> >> >>>> >> -Thanks >>>> >> Steve More >>>> > >>>> > >>> >>> >> >> >> >> >

