[flexcoders] Re: Exceeding Flash's Capabilities?
66 line series with 218 plot points each for a total of 14388 plot points, if we're looking for specifics. It's a lot of data that doesn't look particularly good because of the sheer volume, but it's what they want. I'm using a line chart. Using AMF3 to retrieve the data. The time it takes to query the data, or transmit the data, isn't an issue. Also, the problem doesn't happen over time, it could be the first request someone makes on the application - I don't believe it's a memory leak. The method used to populate the graph is thus: var ls:LineSeries = new LineSeries(); ls.dataProvider = data[o]; ls.yField = "counter"; ls.xField = "dtime"; ls.displayName = o.valueOf(); if ( circleplots.selected ) { ls.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer)); } var currentSeries:Array = linechart1.series; currentSeries.push(ls); linechart1.series = currentSeries; Storing the data in an internal array, and possibly sending it to the clip board isn't a big issue. It's trying to display that much data within a flex construct that causes the problem(s). Jacob --- In flexcoders@yahoogroups.com, Richard Rodseth wrote: > > How many items are you (and the Excel user) talking about? > What sort of Flex charts are you using? > Are you using AMF, XML or JSON to retrieve the data? > > On Wed, Apr 14, 2010 at 3:48 PM, trefalgar wrote: > > > > > > > The majority of my flex work revolves around graphing data. If for some > > reason a user picks a lot of statistics to graph, over an even longer period > > of time, the amount of data that comes back to the Flash application > > overwhelms flash, consuming all of the boxes resources and regularly > > crashing the browser. > > > > Is there anything in the developers bag of tricks to help with this kind of > > problem, or is the sheer amount of data too much for the > > application/SDK/solution to handle? > > > > I understand I can put a limit on the amount of data returned, but as the > > user states, "I can pull it out of the database, via Excel, and it works". > > > > Tref > > > > > > >
[flexcoders] Exceeding Flash's Capabilities?
The majority of my flex work revolves around graphing data. If for some reason a user picks a lot of statistics to graph, over an even longer period of time, the amount of data that comes back to the Flash application overwhelms flash, consuming all of the boxes resources and regularly crashing the browser. Is there anything in the developers bag of tricks to help with this kind of problem, or is the sheer amount of data too much for the application/SDK/solution to handle? I understand I can put a limit on the amount of data returned, but as the user states, "I can pull it out of the database, via Excel, and it works". Tref
[flexcoders] Empty Combobox with confirmed data in dataProvider
I searched the forum and Google unsuccessfully to see if someone else reported this problem and I came up empty. A while back I posted about questions with AsyncTokens and it was suggested I update my SDK within Flex, I updated to 3.5 from the default Flex SDK version. Since that time, I've had random issues with any app I've rebuilt/updated and pushed out with this new SDK. The problem is simple, I have a bindable variable defined as an Array, with data being pushed into it: userlist = ArrayUtil.toArray(event.result); Within the MXML, the definition is pretty straight forward as well: The problem is, the combobox is never updated with the data. I can throw in debug or trace userlist, and the data is there. This isn't a problem if I compile the application with the older version of the SDK. My only workaround, that I've found, is to set the dataProvider directly, instead of populating the bindable variable: userbox.dataProvider = ArrayUtil.toArray(event.result); Has anyone else seen this? Was I just doing it the "wrong way" the first time, and it just happened to work? Thanks in advance.
[flexcoders] Re: Flex, SOAP and Process Flow
--- In flexcoders@yahoogroups.com, "Amy" wrote: > Honestly, I'm not sure how it is that you don't see any difference between > what I my example shows and what you're doing. My fault/result method > signatures are completely different--they have a different number of > arguments and expect different data types. These are the kind of details you > need to train yourself to pick up on, or you're going to continue to find the > documentation unhelpful. *chuckle* Arguments are easily detected, as are the differences - it simply wont work if you're sending too many or too few arguments to a new function call (custom or stock). But in the case of your fault/result method, it's a simple thing to work around. The way the other responder works, at least in the documentation and code examples I've seen, it's pretty clear how to get the result/fault and the AsyncToken. But in the end, that's not the issue ... if the responder never seems to be called, everything else is moot :\ This is why I'm wondering if you can't wrap AsyncToken calls around AsyncToken calls - if the SDK just gets confused or ignores nesting like that. Either way, closure appears to be working for me right now, which is the important part. Tref
[flexcoders] Re: Flex, SOAP and Process Flow
--- In flexcoders@yahoogroups.com, "trefalgar" wrote: > > --- In flexcoders@yahoogroups.com, "Amy" wrote: > > I always use mx.rpc.Responder instead of AsyncResponder (is that a custom > > class?). There's a working example of using AsyncToken with AMFPHP here > > http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html > > . Maybe that will help you see something the docs aren't showing you. > > var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray); > token.info = email; > token.addResponder(new AsyncResponder(myResults,myFaults,token)); I forgot this little bit - using Responder over AsyncResponder. As far as I can tell, it's not a custom class as it's included by default in the SDK. As far as usage, if I use Responder over AsyncResponder, I get the following error: 1067: Implicit coercion of a value of type flash.net:Responder to an unrelated type mx.rpc:IResponder. I'll see if I can figure that out, but AsyncTokens definitely don't seem to like me. Tref
[flexcoders] Re: Flex, SOAP and Process Flow
--- In flexcoders@yahoogroups.com, "Amy" wrote: > I always use mx.rpc.Responder instead of AsyncResponder (is that a custom > class?). There's a working example of using AsyncToken with AMFPHP here > http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html > . Maybe that will help you see something the docs aren't showing you. Thanks for the tip, Amy, but it doesn't look any different than what I have. Additionally, I didnt see any change in behavior from SDK 3.1 to SDK 3.5. Intentionally brief, here: import mx.rpc.AsyncToken; import mx.rpc.AsyncResponder; var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray); token.info = email; token.addResponder(new AsyncResponder(myResults,myFaults,token)); private function myResults(event:Object, token:AsyncToken):void { var resultEvent:ResultEvent = ResultEvent(event); } private function myFaults(event:Object, token:AsyncToken):void { var faultEvent:FaultEvent = FaultEvent(event); } disableStatistics is called, and executes correctly. I see the reply coming back in but neither myResults nor myFaults is ever called. If I add a listener ... myService.adddisableStatisticsEventListener(myResultHandlingFunction); ... the listener's result function is called, but I have no token data from the AsyncToken/AsyncResponder. Could the problem be due to AsyncTokens being used within the Flex generated coded based off the WSDL? ie, wrapping AsyncToken calls around other AsyncToken calls? Tref
[flexcoders] Re: Flex, SOAP and Process Flow
Thanks for this post. I thought I had updated to SDK 3.3, but it looks like my default was still 3.1. I updated Flex Builder to use the 3.3 SDK and I'll give it all a second try. I'll also take a look at Amy's URL, to make sure I'm doing things in a kosher manner. Tref --- In flexcoders@yahoogroups.com, "peeyushtuli" wrote: > > Asynctokens do work. I havent seen a single case of the handlers not being > invoked being linked to some bug in flex sdk. Can you please post some code > snippets of how exactly you used the asynctoken and mention the flex sdk? > > > --- In flexcoders@yahoogroups.com, "trefalgar" wrote: > > > > I've given up for now. > > > > AsyncTokens appear to be the way to go, but by the documentation I've seen > > it *should* work, but the result/fault handlers are never hit. I decided to > > try using 'closure' instead - I'm not even sure if the variables will > > remain stateful, but it's at least in a forward direction for now. > > > > I think this is another case of the documentation being abysmally lacking. > > > > Tref > > > > --- In flexcoders@yahoogroups.com, "trefalgar" wrote: > > > > > > Yeap, looking at that now and having little luck as well. > > > > > > http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_23313753.html, > > > for example, shows someone with a similar problem with a similar > > > solution. Here's what I've got ... > > > > > > var myService:Statistics = new Statistics(null,endPoint); > > > var token:AsyncToken = > > > myService.disableStatistics(user,pass,email,tArray); > > > token.email = email; > > > token.addResponder(new AsyncResponder(myResults,myFaults,token)); > > > > > > myResults and myFaults are never hit. If I use addEventListener against > > > myService instead, I get the resulting data, but nothing from the > > > token:AsyncToken. > > > > > > I'm not comfortable that I have the AsyncToken set up properly, since it > > > doesnt make sense to make the call to myService before 'email' or > > > 'addResponder' is issued, which is what I'm playing with right now. > > > > > > Treffy > > > > > > > > > --- In flexcoders@yahoogroups.com, João Fernandes > > > wrote: > > > > > > > > You can add a responder to your AsyncToken which will carry your fault > > > > and > > > > result handlers. > > > > > > > > 2010/1/18 trefalgar > > > > > > > > > > > > > > > > > > > For those wanting to follow this suggestion, there's a good example > > > > > here: > > > > > http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. > > > > > It's > > > > > towards the bottom, "Using a return token". > > > > > > > > > > Unfortunately, this example doesn't appear to work for me. It uses the > > > > > Flex-built SOAP code and an AsyncToken to keep track of things. I > > > > > don't have > > > > > a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event > > > > > listener to my AsyncToken. > > > > > > > > > > Back to the drawing board I go. > > > > > > > > > > Jacob > > > > > > > > > > > > > > > --- In flexcoders@yahoogroups.com , João > > > > > Fernandes wrote: > > > > > > > > > > > > > That said, since #2 doesn't tell me what user it's replying "no" > > > > > > > to, > > > > > > > if I do this in a loop with 100 users, it could be replying back > > > > > > > with > > > > > > > 20 "no"s and I can't tell how I'd match the replies up with the > > > > > requests. > > > > > > Yes you can, try using the asyncToken generated by > > > > > > service.invokeWs(user) and store your user in some property (eg. > > > > > > currentUser) , once you get the resultEvent, that AsyncToken will > > > > > > have > > > > > > the corresponding user stored (event.token.currentUser). > > > > > > > > > > > > -- > > > > > > > > > > > > João Fernandes > > > > > > > > > > > > Adobe Certified Expert > > > > > > Adobe Community Expert > > > > > > http://www.twitter.com/joaofernandes > > > > > > http://www.riapt.org > > > > > > Portugal Adobe User Group (http://aug.riapt.org) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > João Fernandes > > > > > > > > > >
[flexcoders] Re: Flex, SOAP and Process Flow
I've given up for now. AsyncTokens appear to be the way to go, but by the documentation I've seen it *should* work, but the result/fault handlers are never hit. I decided to try using 'closure' instead - I'm not even sure if the variables will remain stateful, but it's at least in a forward direction for now. I think this is another case of the documentation being abysmally lacking. Tref --- In flexcoders@yahoogroups.com, "trefalgar" wrote: > > Yeap, looking at that now and having little luck as well. > > http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_23313753.html, > for example, shows someone with a similar problem with a similar solution. > Here's what I've got ... > > var myService:Statistics = new Statistics(null,endPoint); > var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray); > token.email = email; > token.addResponder(new AsyncResponder(myResults,myFaults,token)); > > myResults and myFaults are never hit. If I use addEventListener against > myService instead, I get the resulting data, but nothing from the > token:AsyncToken. > > I'm not comfortable that I have the AsyncToken set up properly, since it > doesnt make sense to make the call to myService before 'email' or > 'addResponder' is issued, which is what I'm playing with right now. > > Treffy > > > --- In flexcoders@yahoogroups.com, João Fernandes > wrote: > > > > You can add a responder to your AsyncToken which will carry your fault and > > result handlers. > > > > 2010/1/18 trefalgar > > > > > > > > > > > For those wanting to follow this suggestion, there's a good example here: > > > http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. It's > > > towards the bottom, "Using a return token". > > > > > > Unfortunately, this example doesn't appear to work for me. It uses the > > > Flex-built SOAP code and an AsyncToken to keep track of things. I don't > > > have > > > a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event > > > listener to my AsyncToken. > > > > > > Back to the drawing board I go. > > > > > > Jacob > > > > > > > > > --- In flexcoders@yahoogroups.com , João > > > Fernandes wrote: > > > > > > > > > That said, since #2 doesn't tell me what user it's replying "no" to, > > > > > if I do this in a loop with 100 users, it could be replying back with > > > > > 20 "no"s and I can't tell how I'd match the replies up with the > > > requests. > > > > Yes you can, try using the asyncToken generated by > > > > service.invokeWs(user) and store your user in some property (eg. > > > > currentUser) , once you get the resultEvent, that AsyncToken will have > > > > the corresponding user stored (event.token.currentUser). > > > > > > > > -- > > > > > > > > João Fernandes > > > > > > > > Adobe Certified Expert > > > > Adobe Community Expert > > > > http://www.twitter.com/joaofernandes > > > > http://www.riapt.org > > > > Portugal Adobe User Group (http://aug.riapt.org) > > > > > > > > > > > > > > > > > > > > > -- > > > > João Fernandes > > >
[flexcoders] Re: Flex, SOAP and Process Flow
Yeap, looking at that now and having little luck as well. http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_23313753.html, for example, shows someone with a similar problem with a similar solution. Here's what I've got ... var myService:Statistics = new Statistics(null,endPoint); var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray); token.email = email; token.addResponder(new AsyncResponder(myResults,myFaults,token)); myResults and myFaults are never hit. If I use addEventListener against myService instead, I get the resulting data, but nothing from the token:AsyncToken. I'm not comfortable that I have the AsyncToken set up properly, since it doesnt make sense to make the call to myService before 'email' or 'addResponder' is issued, which is what I'm playing with right now. Treffy --- In flexcoders@yahoogroups.com, João Fernandes wrote: > > You can add a responder to your AsyncToken which will carry your fault and > result handlers. > > 2010/1/18 trefalgar > > > > > > > For those wanting to follow this suggestion, there's a good example here: > > http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. It's > > towards the bottom, "Using a return token". > > > > Unfortunately, this example doesn't appear to work for me. It uses the > > Flex-built SOAP code and an AsyncToken to keep track of things. I don't have > > a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event > > listener to my AsyncToken. > > > > Back to the drawing board I go. > > > > Jacob > > > > > > --- In flexcoders@yahoogroups.com , João > > Fernandes wrote: > > > > > > > That said, since #2 doesn't tell me what user it's replying "no" to, > > > > if I do this in a loop with 100 users, it could be replying back with > > > > 20 "no"s and I can't tell how I'd match the replies up with the > > requests. > > > Yes you can, try using the asyncToken generated by > > > service.invokeWs(user) and store your user in some property (eg. > > > currentUser) , once you get the resultEvent, that AsyncToken will have > > > the corresponding user stored (event.token.currentUser). > > > > > > -- > > > > > > João Fernandes > > > > > > Adobe Certified Expert > > > Adobe Community Expert > > > http://www.twitter.com/joaofernandes > > > http://www.riapt.org > > > Portugal Adobe User Group (http://aug.riapt.org) > > > > > > > > > > > > > -- > > João Fernandes >
[flexcoders] Re: Flex, SOAP and Process Flow
For those wanting to follow this suggestion, there's a good example here: http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. It's towards the bottom, "Using a return token". Unfortunately, this example doesn't appear to work for me. It uses the Flex-built SOAP code and an AsyncToken to keep track of things. I don't have a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event listener to my AsyncToken. Back to the drawing board I go. Jacob --- In flexcoders@yahoogroups.com, João Fernandes wrote: > > > That said, since #2 doesn't tell me what user it's replying "no" to, > > if I do this in a loop with 100 users, it could be replying back with > > 20 "no"s and I can't tell how I'd match the replies up with the requests. > Yes you can, try using the asyncToken generated by > service.invokeWs(user) and store your user in some property (eg. > currentUser) , once you get the resultEvent, that AsyncToken will have > the corresponding user stored (event.token.currentUser). > > -- > > João Fernandes > > Adobe Certified Expert > Adobe Community Expert > http://www.twitter.com/joaofernandes > http://www.riapt.org > Portugal Adobe User Group (http://aug.riapt.org) >
[flexcoders] Re: Flex, SOAP and Process Flow
That's interesting. It seems that the WSDL Importer uses AsyncTokens all over the place, but I never see any of them in the variables during a debug session. I'm now questioning if the importer actually made everything more complex than it needed to be ;) Thanks for the tip, João. I'm going to see if I can figure it out. Tref --- In flexcoders@yahoogroups.com, João Fernandes wrote: > Yes you can, try using the asyncToken generated by > service.invokeWs(user) and store your user in some property (eg. > currentUser) , once you get the resultEvent, that AsyncToken will have > the corresponding user stored (event.token.currentUser). > > -- > > João Fernandes > > Adobe Certified Expert > Adobe Community Expert > http://www.twitter.com/joaofernandes > http://www.riapt.org > Portugal Adobe User Group (http://aug.riapt.org) >
[flexcoders] Re: Flex, SOAP and Process Flow
That makes sense if you can control the data that is sent back to you from the first resultevent (but I can't). 1) Web call - Does the user 'Trefalgar' exist? 2) Web reply - No. (no additional data) 3) Web call - Create user 'Trefalgar' Flex doesnt appear to be linear. That said, since #2 doesn't tell me what user it's replying "no" to, if I do this in a loop with 100 users, it could be replying back with 20 "no"s and I can't tell how I'd match the replies up with the requests. Is there a solution for this problem in Flex/AS? I don't think putting the secondary calls in the resultevent would work, when critical information needed for future calls isn't available in the resultevent. Tref --- In flexcoders@yahoogroups.com, "valdhor" wrote: > > Basically you wait for the resultevent of the first call and put the second > call in that function. > > --- In flexcoders@yahoogroups.com, "trefalgar" wrote: > > > > I've run into an odd problem that I haven't been able to find a solution > > to. In other programming languages (Perl, PHP, for example), if I want to > > do X, Y and Z in order, all with remote calls, it's very easy and straight > > forward. With Flex, I'm pretty confused on how to do something this simple. > > Here's the problem and why I'm confused ... > > > > I'm using Flex and SOAP to talk to a web interface. In order to get to step > > Y, I have to first do step X. I can not skip to step Y without step X being > > complete. But setting up the flow to be two subroutine calls, X first, then > > Y, doesn't mean that X finishes first (and lately means Y actually finishes > > first). > > > > callX(var1,var2); > > callY(var3,var4); > > > > Since Flex uses listeners, and not return() how do you pass data around to > > know that X is complete? > > > > callX(var1,var2); > > {wait for callX to be finished, before continuing} > > callY(var3,var4); > > > > How do you pass data around successfully to do that check? Does my problem > > description make any sense or is my brain fried? ;) > > > > Treffy. > > >
[flexcoders] Flex, SOAP and Process Flow
I've run into an odd problem that I haven't been able to find a solution to. In other programming languages (Perl, PHP, for example), if I want to do X, Y and Z in order, all with remote calls, it's very easy and straight forward. With Flex, I'm pretty confused on how to do something this simple. Here's the problem and why I'm confused ... I'm using Flex and SOAP to talk to a web interface. In order to get to step Y, I have to first do step X. I can not skip to step Y without step X being complete. But setting up the flow to be two subroutine calls, X first, then Y, doesn't mean that X finishes first (and lately means Y actually finishes first). callX(var1,var2); callY(var3,var4); Since Flex uses listeners, and not return() how do you pass data around to know that X is complete? callX(var1,var2); {wait for callX to be finished, before continuing} callY(var3,var4); How do you pass data around successfully to do that check? Does my problem description make any sense or is my brain fried? ;) Treffy.
[flexcoders] Copying linechart series to clipboard
Copying data from a datagrid to a clipboard is easy - tons of examples, lots of methods, it's in a predictable format. What about copying data from a series? Generally speaking, a single line would be easy. Adding lines would be easy, if they had identical hAxis values. The difficulty comes in when you have missing values in some series that the linechart would just draw a line through while connecting the two surrounding, non-missing, points. This would cause the number of values to be less when copied, thus throwing off a simple grab like you do for datagrids. The only thing I can come up with is to copy each line individually with its own header/legend. Has anyone had to tackle this problem before? Any suggestions? Tref
[flexcoders] Re: Referencing dynmically created controls
--- In flexcoders@yahoogroups.com, "trefalgar" wrote: > It works just fine. On the panel I get a list of {text}:, followed by the > actual textinput field. The only problem is I can't figure out how to > reference those textinputs now that they're created! I've searched through a > debug session and can't find the children anywhere, I've also tried using > getChildNameByText, and it always returns null. Sorry if this is a double post, but it seems that when you ask the question, you sometimes find the answer yourself. I was able to get to them via ... for each (var item:Object in searchcanvas.getChildren() ) { trace(item.id); } I'd rather be able to call them directly via {name}.id, but this works. Tref
[flexcoders] Referencing dynmically created controls
I'm striking out finding an answer elsewhere, so here goes ;) I am taking an array of objects and using it to dynamically create a list of text and textinputs: searchcanvas.removeAllChildren(); var fields:Array = ArrayUtil.toArray(event.result.fields); if ( fields.length > 1 ) { for each (var item:Object in fields) { var ctext:Text = new Text; ctext.text = item.Field + ":"; var ctextinput:TextInput = new TextInput; ctextinput.id = item.Field; searchcanvas.addChild(ctext); searchcanvas.addChild(ctextinput); } } It works just fine. On the panel I get a list of {text}:, followed by the actual textinput field. The only problem is I can't figure out how to reference those textinputs now that they're created! I've searched through a debug session and can't find the children anywhere, I've also tried using getChildNameByText, and it always returns null. Any tips? Thank you, Tref
[flexcoders] Datagrids, radiobutton and scrolling
I remember reading an article that talked about this problem, but I can't seem to find it again. I have some radio buttons in a item renderer for a datagrid. Flex, for a reason beyond me, doesn't keep track of radio button values on a per-row basis in a datagrid - it keeps track of them based on the position in the window. So, if you select a single radio button, scroll down a few pages, you'll find another row with a radio button selected, even though you never selected it. I know this has been addressed, but for the life of me I can't find any articles about it again. Can anyone point me in the right direction to fix this problem? Tref
[flexcoders] Re: Variables to reference variables/ids (not variable variables)
Exactly what I needed, and it works just as expected. Thank you very much, Tracy! --- In flexcoders@yahoogroups.com, "Tracy Spratt" wrote: > > You can do: > > this[chart].series = currentSeries; > > > > if "linechart0" is an id for a component instance or a property of "this" > > > > Tracy Spratt, > > Lariat Services, development services available
[flexcoders] Variables to reference variables/ids (not variable variables)
Might be a newbie question, but I'm failing to find this subject in my book or on the web. While you can do variable variables, to create all sorts of fun things, I'm looking to create a variable to reference an object already created. For example ... I have 10 charts on a reporting interface, each with their own id and tab. Right now, if I want to make identical buttons affect individual charts, I'd have to create 10 buttons, each programed to update each individual chart. What I'd like to do is be able to pass the tab name / chart id to the function call, so it will know which chart to update. This way, I only have to create one function to update any chart, instead of 10 functions, one to handle each button/chart. Does that make sense? Is it possible? chart = 'linechart0'; {chart}.series = currentSeries; Tref
[flexcoders] Re: What's wrong with this linechart?
I ended up doing this ... ca3a.splice.apply(ca3a,[ca3a.length,0].concat(data[obj])); ca3a.sortOn("loadval"); ca3.dataProvider = ca3a; ... for each possible axis. Seems like there should be an easier way to do this, without having to define temporary holding variables. This solution also ends up with duplicates (since each line is added separately, they should at some point have horizontal values that are the same), which causes the graph to do all sorts of fun things. T --- In flexcoders@yahoogroups.com, "Trefalgar Bain" wrote: > > --- In flexcoders@yahoogroups.com, "valdhor" wrote: > > Give the CategoryAxis an id... > > > > then, in Actionscript, give it a dataProvider... > > ca.dataProvider = testdata; > > Absolutely right. That's annoying ;) > > I'm now trying to figure out how to dynamically take the current CatagoryAxis > dataProvider and append additional data to it. Probably my fault for not > posting the entire context ... > > private function graphSetup(data:Object, chart:String):void { > for ( var obj:Object in data ) { > var ls:LineSeries = new LineSeries(); > ls.dataProvider = data[obj]; > ls.yField = "val"; > ls.xField = "loadval"; > ls.displayName = obj.valueOf(); > ls.setStyle('itemRenderer', new > ClassFactory(CircleItemRenderer)); > var currentSeries:Array = linechart1.series; > currentSeries.push(ls); > linechart1.series = currentSeries; > ca1.dataProvider.push(data[obj]); > } > } > > ca1.dataProvider.push doesn't work, it actually ends up setting > ca1.dataProvider to null. I can't do this, either ... > > var moo:Array = ca1.dataProvider; > moo.push(data[obj]); > ca1.dataProvider = moo; > > If I ... ca1.dataProvider = data[obj] ... it works but for just a single line > series. > > Hrm. > > Tref >
[flexcoders] Re: What's wrong with this linechart?
--- In flexcoders@yahoogroups.com, "valdhor" wrote: > Give the CategoryAxis an id... > > then, in Actionscript, give it a dataProvider... > ca.dataProvider = testdata; Absolutely right. That's annoying ;) I'm now trying to figure out how to dynamically take the current CatagoryAxis dataProvider and append additional data to it. Probably my fault for not posting the entire context ... private function graphSetup(data:Object, chart:String):void { for ( var obj:Object in data ) { var ls:LineSeries = new LineSeries(); ls.dataProvider = data[obj]; ls.yField = "val"; ls.xField = "loadval"; ls.displayName = obj.valueOf(); ls.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer)); var currentSeries:Array = linechart1.series; currentSeries.push(ls); linechart1.series = currentSeries; ca1.dataProvider.push(data[obj]); } } ca1.dataProvider.push doesn't work, it actually ends up setting ca1.dataProvider to null. I can't do this, either ... var moo:Array = ca1.dataProvider; moo.push(data[obj]); ca1.dataProvider = moo; If I ... ca1.dataProvider = data[obj] ... it works but for just a single line series. Hrm. Tref
[flexcoders] What's wrong with this linechart?
I've got two charts, one is 99% mxml (the 1% is actionscript defining the datasource definition), the other is mostly actionscript. The mxml works, the actionscript does not. Does anyone have any idea what in the world I'm doing wrong? I'd appreciate any pointers, despite how much it could sting. Tref Working: var testdata2:Array = new Array( {loadval: "3.0.C1", passthru: 5}, {loadval: "3.0.C2", passthru: 4}, {loadval: "3.0.C4", passthru: 4.5} ); linechart0.dataProvider = testdata2; NOT Working: var testdata:Array = new Array( {loadval: "3.0.C1", counter: 5}, {loadval: "3.0.C2", counter: 4}, {loadval: "3.0.C4", counter: 4.5} ); var ls:LineSeries = new LineSeries(); ls.dataProvider = testdata; ls.yField = "counter"; ls.xField = "loadval"; ls.displayName = "moo"; ls.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer)); var currentSeries:Array = linechart1.series; currentSeries.push(ls); linechart1.series = currentSeries;
[flexcoders] Re: Adding verticalaxis(es) via actionscript
--- In flexcoders@yahoogroups.com, "Amy" wrote: > There you go. Try using matching data functions on your axes and serieses. I don't understand how a dataFunction could help put data on the correct axis, when it just formats the data for reading the xField and yField. I'm not saying it doesn't/can't work, I just can't visualize how it works, so it's a big stumbling block. The point of the reply, however, is the new 3.3 SDK: axis system now supports multiple axes Obviously something changed to support multiple axes and I'm trying to track down the changes. If you happen to have already found them, I'd appreciate a code snip or pointing to the doc that explains the change. Tref
[flexcoders] Re: Adding verticalaxis(es) via actionscript
--- In flexcoders@yahoogroups.com, "Amy" wrote: > > --- In flexcoders@yahoogroups.com, "Trefalgar Bain" wrote: > > > > --- In flexcoders@yahoogroups.com, "Amy" wrote: > > > I think you just need to play with the dataFunctions and/or > > > labelfunctions on the axes until you get what you want. > > > > > > DataFunction sets the data up to be graphed on the line (sets the > > yField and xField). The lines are graphing fine, just not on the right > > axis. > > Do you have a dataFunction on the axes? > Negative. The xField and yField are defined globally within the data returned to the flex application: for ( var o:Object in event.result ) { var ls:LineSeries = new LineSeries(); ls.dataProvider = event.result[o]; ls.yField = "counter"; ls.xField = "dtime"; ls.displayName = o.valueOf(); ls.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer)); var currentSeries:Array = linechart1.series; var temp:String = o.valueOf(); var index:int = temp.indexOf("scc"); if ( index != -1 ) { ar=new AxisRenderer(); ar.axis=la; renderers.push(ar); } else { } var la:LinearAxis = new LinearAxis(); /* first salesperson will show 0-whatever, subsequent ones will start at the lowest value */ la.baseAtZero = false; ls.verticalAxis = la; currentSeries.push(ls); linechart1.series = currentSeries; } linechart1.verticalAxisRenderers = renderers;
[flexcoders] Re: Adding verticalaxis(es) via actionscript
--- In flexcoders@yahoogroups.com, "Amy" wrote: > I think you just need to play with the dataFunctions and/or > labelfunctions on the axes until you get what you want. DataFunction sets the data up to be graphed on the line (sets the yField and xField). The lines are graphing fine, just not on the right axis. LabelFunction sets the label/title, what to display along the axis or legend as desired. I'm not having a labeling problem. Unless I'm reading something wrong, neither actually ties data to one particular axis or another. I think what I'm doing is doable in mxml (as found in examples in Adobe's help sections), if you have a static number of series, but if you're doing a possibly unlimited number (or X+1), mxml isn't a scalable solution. Tref
[flexcoders] Re: Adding verticalaxis(es) via actionscript
--- In flexcoders@yahoogroups.com, "Amy" wrote: > A quick scan of your code isn't revealing to me what you changed. > Could you add in comments that show where you've modified it? I'm getting close. I've got the lines graphing, but each line is on a different axis (I'll attach the code below). It only displays two axises (which is what I want), but it's obvious that there's more than two since I have 4 lines, all with a value of 1, appearing one above the other (not on the same dot). I need a way to bind multiple rows to a single axis, I just haven't stumbled across it yet. As always, suggestions are welcome ;) Tref var renderers:Array=new Array(); var ar:AxisRenderer=new AxisRenderer(); for ( var o:Object in event.result ) { var ls:LineSeries = new LineSeries(); ls.dataProvider = event.result[o]; ls.yField = "counter"; ls.xField = "dtime"; ls.displayName = o.valueOf(); ls.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer)); var currentSeries:Array = linechart1.series; var temp:String = o.valueOf(); var index:int = temp.indexOf("scc"); if ( index != -1 ) { ar=new AxisRenderer(); ar.axis=la; renderers.push(ar); } else { } var la:LinearAxis = new LinearAxis(); /* first salesperson will show 0-whatever, subsequent ones will start at the lowest value */ la.baseAtZero = false; ls.verticalAxis = la; currentSeries.push(ls); linechart1.series = currentSeries;
[flexcoders] Re: Adding verticalaxis(es) via actionscript
--- In flexcoders@yahoogroups.com, "Amy" wrote: > Have you checked out this example? > http://flexdiary.blogspot.com/2008/08/charting-example.html Below is what I've ended up with. Allowing each line to have its own axis, it does adjust each max/min axis as expected, but I don't get a line on the actual graph. If I use the below code, I get the two axises like I want, but the default axis isn't adjusting to the lines that I think are latched to it (I also still don't get any lines on the graph). In debug, I can see that each series has the data in it for each datapoint/line that should be graphed. I'm not certain why it's not being displayed. labase is defined as the default verticalaxis within the MXML. Any suggestions? T //linechart1.dataProvider=event.result; linechart1.seriesFilters=[]; //keep from clipping renderers linechart1.clipContent=false; //set up the grid lines var gl:GridLines = new GridLines(); gl.y = -.5; //can't set strokes in mx:Style declarations linechart1.backgroundElements=[gl]; //set up the primary horizontal axes var ca:CategoryAxis = new CategoryAxis(); ca.categoryField='dtime'; ca.displayName='Date'; linechart1.horizontalAxis = ca; var ar:AxisRenderer=new AxisRenderer(); ar.axis = ca; linechart1.horizontalAxisRenderers=[ar]; /* loop through our salespeople and make a series for each assumes all salespeople are present in first node */ var serieses:Array=new Array(); var renderers:Array=new Array(); for (var o:Object in event.result){ var series:LineSeries = new LineSeries(); /* since the data is nested for legibility, we can't just use xField and yField */ series.dataProvider = event.result[o]; series.yField = "counter"; series.xField = "dtime"; series.displayName = o.valueOf() //can't set renderers in mx:Style either series.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer)); /* We're going to give each series its own vertical axis because we can. Note this depends on there only being two series. More would just be odd. */ var la:LinearAxis = new LinearAxis(); la.displayName = o.valueOf(); /* first salesperson will show 0-whatever, subsequent ones will start at the lowest value */ la.baseAtZero = false; series.verticalAxis = la; //create a new axis renderer for this axis var temp:String = o.valueOf(); var index:int = temp.indexOf("scc"); if ( index != -1 ) { ar=new AxisRenderer(); ar.axis=la; renderers.push(ar); } else { series.verticalAxis = labase; } serieses.push(series); } //add serieses to chart linechart1.series=serieses; //add verticalaxisrenderers linechart1.verticalAxisRenderers=renderers; //show chart //addChild(linechart1);
[flexcoders] Re: Adding verticalaxis(es) via actionscript
--- In flexcoders@yahoogroups.com, "Amy" wrote: > Have you checked out this example? > http://flexdiary.blogspot.com/2008/08/charting-example.html I most certainly have ;) It's where I came up with ... var ar:AxisRenderer=new AxisRenderer(); var la:LinearAxis = new LinearAxis(); la.title = 'SCC KPI'; la.baseAtZero = false; ar = new AxisRenderer(); ar.axis=la; linechart1.verticalAxisRenderers.push(ar); The example creates a new axis for each data point, not one new axis for a specific line. I think I'll try rewriting my entire block of code for generating the lines with what's in the example and see if I can make heads or tails of it ... Tref
[flexcoders] Adding verticalaxis(es) via actionscript
I'm having a rough time getting data to auto-scale to multiple vertical axises. If I use a single axis, the data is graphed without a problem - all the lines show up exactly as they should. The problem I'm trying to solve is that one of the lines is ~100, while the others are less than 20. I'd like to get the ~100 line (I know which one it is ahead of time) on its own axis, so it doesn't skew the graph. I can add a second axis, but no matter what I try, or what examples I scrape off of, I can't seem to get the data to 'bind' to the second axis. var ar:AxisRenderer=new AxisRenderer(); for ( var o:Object in event.result ) { var ls:LineSeries = new LineSeries(); ls.dataProvider = event.result[o]; ls.yField = "counter"; ls.xField = "dtime"; ls.displayName = o.valueOf(); // Create a verticle axis for SCC var s:String = o.valueOf(); var index:int = s.indexOf("scc"); if ( index != -1 ) { var la:LinearAxis = new LinearAxis(); la.title = 'SCC KPI'; la.baseAtZero = false; ls.verticalAxis = la; ar = new AxisRenderer(); ar.axis=la; linechart1.verticalAxisRenderers.push(ar); } else { //ls.verticalAxis = ar1; } var currentSeries:Array = linechart1.series; currentSeries.push(ls); linechart1.series = currentSeries; // Create a DateTimeAxis horizontal axis. var hAxis:DateTimeAxis = new DateTimeAxis(); hAxis.dataUnits = "minutes"; //hAxis.labelUnits = "weeks"; // Set this to false to display the leftmost label. hAxis.alignLabelsToUnits = false; // Take the date in its current format and create a Date // object from it. hAxis.parseFunction = createDate; hAxis.labelFunction = labelParser; linechart1.horizontalAxis = hAxis; } Any suggestions? Tref ps. As a side question, if someone can fill me in on how to get the style on an added axis to look like the 'default' flex axis it would be a big help as well.