[flexcoders] Help - need to access all chartItems! (bug in findDataPoints()?)
I'm trying to refer to all of my ColumnChart's chartItems at runtime, but findDataPoints() only ever returns 1 object in its hitData array, no matter how large I set the mouseSensitivity with dataTipMode=multiple (I also get a compile-time error when trying to directly refer to the items array of my ColumnSeries, even though this array of chartItems exists at run time). So first off, any suggestions for how to refer to all currently displayed chartItems - without using findDataPoints - would be immensely helpful (it's the final piece in a quick-and-easy way to turn column highlights on and off, so I can post that when I solve this!). The larger issue is that there might be a bug in findDataPoints(), since - except for PlotChart - no chart I've found will display multiple dataTips in the same series. Below is the example from the Developer's Guide on dataTipMode, where I've set the mouseSensitivity to 1 and replaced one of the BarSeries with a PlotSeries: you can see how it will only show multiple dataTips (as returned from findDataPoints) for the PlotSeries. Thanks for any advice! -Peter Demling Lexington, MA ?xml version=1.0? !-- charts/DataTipsMultiple.mxml -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var expenses:ArrayCollection = new ArrayCollection([ {Month:Jan, Profit:2000, Expenses:1500}, {Month:Feb, Profit:1000, Expenses:200}, {Month:Mar, Profit:1500, Expenses:500} ]); ]]/mx:Script mx:Panel title=Bar Chart mx:CartesianChart id=myChart dataProvider={expenses} showDataTips=true mouseSensitivity=1 dataTipMode=multiple mx:verticalAxis mx:CategoryAxis dataProvider={expenses} categoryField=Month / /mx:verticalAxis mx:series mx:BarSeries yField=Month xField=Profit / mx:PlotSeries yField=Month xField=Expenses / /mx:series /mx:CartesianChart mx:Legend dataProvider={myChart}/ /mx:Panel /mx:Application
[flexcoders] Re: Help - need to access all chartItems! (not a bug in findDataPoints())
Ely/Tom, Thanks for the replies! As far as accessing the chart items...Tom is right, subclassing and exposing the chartItems out of the renderData is the way to go. Ok; this is probably a subclassing-neophyte quetion, but is the following what you mean?: 1]extend ColumnSeries.as (not ColumnChart.as!) in a new class 2]add a new public getter method to simply return the private var _renderData 3]Use this new CustomColumnSeries in my app, which now has a publically accessible _renderData array About findDataPoints() - various series types optimize under the assumption that their data never overlaps Do you know where the different chart types make this distinction? If I'm subclassing ColumnSeries anyway, it would be nice (for this and other uses) to override findDataPoints() to sometimes return multiple or all items (that whole 'show all dataTips' thing, for example). I see that findDataPoints() is defined in ChartBase (which all charts inherit from), so I'm not seeing where the different chart types apply differing logic to allow/disallow multiples. many thanks, -Peter [BTW, my ultimate goal here is to highlight/unhighlight column items by adjusting the alpha of their itemRenderers. I was elated to find that the following works when clicking one chartItem: event.hitData.chartItem.itemRenderer.alpha = 0.3; Wonderfully simple way to visually distinguish the selected chartItem! Only problem is, I need to loop through the other chartItems first, to make sure their alpha is 1 (to reset any previously-clicked chartItem). So I just need a way to say reset the alpha of all items in this series to x.] As far as accessing the chart items...Tom is right, subclassing and exposing the chartItems out of the renderData is the way to go. Ely. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Peter Demling Sent: Friday, June 08, 2007 8:41 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Help - need to access all chartItems! (bug in findDataPoints()?) I'm trying to refer to all of my ColumnChart's chartItems at runtime, but findDataPoints() only ever returns 1 object in its hitData array, no matter how large I set the mouseSensitivity with dataTipMode=multiple (I also get a compile-time error when trying to directly refer to the items array of my ColumnSeries, even though this array of chartItems exists at run time). So first off, any suggestions for how to refer to all currently displayed chartItems - without using findDataPoints - would be immensely helpful (it's the final piece in a quick-and-easy way to turn column highlights on and off, so I can post that when I solve this!). The larger issue is that there might be a bug in findDataPoints(), since - except for PlotChart - no chart I've found will display multiple dataTips in the same series. Below is the example from the Developer's Guide on dataTipMode, where I've set the mouseSensitivity to 1 and replaced one of the BarSeries with a PlotSeries: you can see how it will only show multiple dataTips (as returned from findDataPoints) for the PlotSeries. Thanks for any advice! -Peter Demling Lexington, MA ?xml version=1.0? !-- charts/DataTipsMultiple.mxml -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var expenses:ArrayCollection = new ArrayCollection([ {Month:Jan, Profit:2000, Expenses:1500}, {Month:Feb, Profit:1000, Expenses:200}, {Month:Mar, Profit:1500, Expenses:500} ]); ]]/mx:Script mx:Panel title=Bar Chart mx:CartesianChart id=myChart dataProvider={expenses} showDataTips=true mouseSensitivity=1 dataTipMode=multiple mx:verticalAxis mx:CategoryAxis dataProvider={expenses} categoryField=Month / /mx:verticalAxis mx:series mx:BarSeries yField=Month xField=Profit / mx:PlotSeries yField=Month xField=Expenses / /mx:series /mx:CartesianChart mx:Legend dataProvider={myChart}/ /mx:Panel /mx:Application
[flexcoders] Highlight a selected chartItem: a quick and easy way
Problem: you click on a chartItem; how do you give it a persistent visual mark to show that it's the currently selected item? This issue has vexed me for weeks, and while there are a several different solutions with powerful benefits (manually create a ToolTip with ToolTipManager; use Ely's dataDrawingCanvas; use a conditional itemRenderer, etc), here's one easy, simple solution: 1] Specify an inline itemRenderer for the Series, initializing the alpha to less than 1 (I like 0.8) 2] Declare a global ChartItem variable named prevSelectedItem 3] In your event handler for clicking on a chartItem, reset the alpha of the previously selected chartItem (if any) to the unhighlighted value (in this case 0.8); and then set the currently selected item to the highlighted value (in this case 1) That's it; example code is below. Now you could certainly define your own custom itemRenderer, and expose more than just the alpha property in order to alter the visual appearance; and I very well may be missing additional visual properties of the chartItem that you can manipulate here out of the box (suggestions, anyone?); but for sheer simplicity, this approach is real easy to work with. Regards, -Peter Demling Lexington, MA ?xml version=1.0? !-- charts/DataTipsMultiple.mxml -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script![CDATA[ import mx.collections.ArrayCollection; import mx.charts.events.ChartItemEvent; import mx.charts.ChartItem; [Bindable] public var expenses:ArrayCollection = new ArrayCollection([ {Month:Jan, Profit:2000, Expenses:1500}, {Month:Feb, Profit:1000, Expenses:200}, {Month:Mar, Profit:1500, Expenses:500}, {Month:Apr, Profit:2500, Expenses:1700}, {Month:May, Profit:2000, Expenses:800} ]); private var prevSelectedColumn:ChartItem; private function itemClicked(e:ChartItemEvent):void{ if (prevSelectedColumn) prevSelectedColumn.itemRenderer.alpha = 0.8; prevSelectedColumn = e.hitData.chartItem; e.hitData.chartItem.itemRenderer.alpha = 1; } ]]/mx:Script mx:Panel title=Column Chart mx:ColumnChart id=myChart dataProvider={expenses} showDataTips=true itemClick=itemClicked(event) mx:horizontalAxis mx:CategoryAxis dataProvider={expenses} categoryField=Month/ /mx:horizontalAxis mx:series mx:ColumnSeries yField=Profit mx:itemRenderer mx:Component mx:BoxItemRenderer alpha=0.8 / /mx:Component /mx:itemRenderer /mx:ColumnSeries /mx:series /mx:ColumnChart /mx:Panel /mx:Application
[flexcoders] Can I use a variable to refer to an object's property name?
(This is a fundamental question, and it' challenging to find a clear way to ask it): Let's say I have an ArrayCollection data source with 50 fields (which I do), and my user selects the name of one of these fields (let's say PRODUCT) with myComboBox, so that it's now in myComboBox.selectedItem.data. How can I make actionScript use this value dynamically, so that instead of coding a switch with 50 cases for each property like so: switch(myComboBox.selectedItem.data){ case PRODUCT: return item.PRODUCT; break; case FIELD2: return item.FIELD2; break; case FIELD3: return item.FIELD3; break; ... } ? Can I can instead do something like item.[myComboBox.selectedItem.data]? Do you know what I mean? Something like item.getValueofNamedProperty(myComboBox.selectedItem.data);. [Without complicating the question, I ask because this would greatly simplify a complex charting component I'm developing, where the user should be able to summarize the underlying data based on any of the fields; so I need to know the selected property for the filter function, the toolTip, the sort function, etc. Right now I'm only supporting 3 properties, since I'm relying on nested switch statements like the one above]. Hopefully I'm just missing a really basic piece of actionScript syntax. Many thanks for any suggestions! -Peter Demling Lexington, MA
[flexcoders] Re: Can I use a variable to refer to an object's property name?
Actually, I think item[myComboBox.selectedItem.data] should actually work just fine That's it! Don't know why I didn't see that before. Thanks for your help. -Peter Ed Peter Demling wrote: (This is a fundamental question, and it' challenging to find a clear way to ask it): Let's say I have an ArrayCollection data source with 50 fields (which I do), and my user selects the name of one of these fields (let's say PRODUCT) with myComboBox, so that it's now in myComboBox.selectedItem.data. How can I make actionScript use this value dynamically, so that instead of coding a switch with 50 cases for each property like so: switch(myComboBox.selectedItem.data){ case PRODUCT: return item.PRODUCT; break; case FIELD2: return item.FIELD2; break; case FIELD3: return item.FIELD3; break; ... } ? Can I can instead do something like item.[myComboBox.selectedItem.data]? Do you know what I mean? Something like item.getValueofNamedProperty(myComboBox.selectedItem.data);. [Without complicating the question, I ask because this would greatly simplify a complex charting component I'm developing, where the user should be able to summarize the underlying data based on any of the fields; so I need to know the selected property for the filter function, the toolTip, the sort function, etc. Right now I'm only supporting 3 properties, since I'm relying on nested switch statements like the one above]. Hopefully I'm just missing a really basic piece of actionScript syntax. Many thanks for any suggestions! -Peter Demling Lexington, MA
[flexcoders] Setting dataTipCalloutStroke={null} when dataTipMode=multiple?
Hello, I have a CartesianChart where I don't want the calloutStroke to be drawn (and thereby offset the positioning of the dataTips from their data point), so I've set dataTipCalloutStroke={null}. This works fine when dataTipMode=single, but it does not work when I set dataTipMode=multiple: the callout is still drawn and the dataTips are offset. Any ideas? This is kind of a deal-breaker for my app, since a major feature is to display my custom dataTips directly adjacent to all (plot) data points at the same time. I suppose I could go way-deep into concatenating the default itemRenderer and the dataTip's custom contents into a custom itemRenderer, but I'd rather not have to code all that internal plumbing if I could instead do it all with this one style setting. Thanks for any suggestions! -Peter Demling Lexington, MA
[flexcoders] Re: Setting dataTipCalloutStroke={null} when dataTipMode=multiple?
Thanks for the reply, Ely! I really appreciate your input. myChart.setStyle(calloutStroke,null); This works to hide the calloutStroke... ...but the positions of the dataTip boxes still get offset from the chartItems (in my case, far away from the DiamondItemRenderers of my plotSeries). In other words, when dataTipMode=multiple, I want the dataTip boxes to position themselves like they do when dataTipMode=single: i.e., a few pixels to the northeast of the chartItem. My real end goal is to show the all the items in the plotSeries, with their corresponding dataTips right next to them (I'm using a high mouseSensitivity to forcibly show multiple dataTips right now, but I know I'll eventually have to explicitly dispatch MOUSE_OVER, or else override findDataPoints and toggle all the showDataTips value to false/true). If I can't force the offset-positioning of these dataTips in order to align nicely with their chartItems, do you think I need to use a custom ItemRenderer instead? Your StoplightItemRenderer example at qs* is quite helpful in this regard, but I can't figure out how I'd also draw text values from the chartItem adjacent to the DiamondItemRenderer (e.g., Smith,John (age 30) adjacent to the diamond graphic). Thanks again for any suggestions; believe me, little bumps in the road like this don't take away from the enormous benefit this charting API has already been for us. Regards, -Peter Demling Lexington, MA *is quietlyScheming.com down? I lost connection this morning... --- In flexcoders@yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] wrote: Peter - Took a peek at the code, and that looks to be an unfortunately bug on my part. Use 'calloutStroke' instead of 'dataTipCalloutStroke' style. You might have to set it programmatically: myChart.setStyle(calloutStroke,null); That should solve the problem (and in a more performant way). Ely. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Peter Demling Sent: Friday, May 18, 2007 7:19 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Setting dataTipCalloutStroke={null} when dataTipMode=multiple? Hello, I have a CartesianChart where I don't want the calloutStroke to be drawn (and thereby offset the positioning of the dataTips from their data point), so I've set dataTipCalloutStroke={null}. This works fine when dataTipMode=single, but it does not work when I set dataTipMode=multiple: the callout is still drawn and the dataTips are offset. Any ideas? This is kind of a deal-breaker for my app, since a major feature is to display my custom dataTips directly adjacent to all (plot) data points at the same time. I suppose I could go way-deep into concatenating the default itemRenderer and the dataTip's custom contents into a custom itemRenderer, but I'd rather not have to code all that internal plumbing if I could instead do it all with this one style setting. Thanks for any suggestions! -Peter Demling Lexington, MA
[flexcoders] Re: Setting dataTipCalloutStroke={null} when dataTipMode=multiple?
Thanks for the details on the options, especially #3. 1) Use the data graphics drawing API (see the post on my blog). Excellent; I'll start with this (I need to demo a proof-of-concept this weekend). QuietlyScheming is still refusing my connection, though (it must know I want to do unsavory things with dataTips). 2) Write a custom item renderer Once I'm in updateDisplayList() and I have access to the _ChartItem, is it possible to then output the contents of a data field from the item (e.g. _ChartItem.hitData.item.NAME in a Label to output Smith,John via addChild() or something), or is it restricted to pure Graphics drawing methods? 3) Write a custom series (or extension to plot series) I like that as my eventual solution; and assuming that the answer to the above question is no, I assume this would be the only way to embed data provider fields (e.g. Smith,John from the ChartItem) into the ItemRenderer? thanks again, -Peter Demling Lexington, MA --- In flexcoders@yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] wrote: DataTips were really written to be interactive tips, while a lot of people have asked for functionality that allows you to treat them more like labels. We hear the request, and are considering ways to update it for a future release. If I wanted to put labels on the plot items, I'd probably, in increasing order of difficulty: 1) Use the data graphics drawing API (see the post on my blog). Pro: very easy. Con: less performant. 2) Write a custom item renderer. Pro: more performant, leverages existing plot series. Con: axes won't automatically make sure there's enough room for the labels. 3) Write a custom series (or extension to plot series). Pro: best performance option, best experience (can make the chart axes make room for labels). Con: requires understanding writing custom series. Personally, I'd suggest taking a shot at #3. Writing a custom series really isn't all that difficult, esp. for a plot series, which is the simplest kind. I'd probably try this: 1) Extend PlotSeries. 2) In the constructor for your extension, create a UIComponent and addChild it. This will be the sprite that will contain your labels. 3) Override the get labelLayer property, and return a reference to that UIComponent. This makes sure the chart adds it to your display, above all the series, so labels don't appear under items. 4) Override updateDisplayList. First call the super. Second, for each chart item in the renderData.filteredCache array, create a Label (or some custom component), position it where you want relative to the x/y values in the chart item, and add it as a child to your labelLayer. 5) Override describeData. This is the method where you tell the axes what range your data represents. You also have the option of telling the series that you need a certain number of pixels on either size of your data. You'll want to report to the axis that you need space to the right of your data for the label. See the ASDoc for describeData for more details. 6) Optimize. Reuse your labels in your updateDisplayList function, etc. 7) Deal with transitions, if you want. Eearlier I said that in updateDisplayList, you want to look at the renderData.filteredCache array. With transitions, it's a little more complicated. You might have a transitionRenderData property, in which case you want to use that. Your transition render data property might have an elementBounds array, in which case you want to use that instead. Honestly, in my experience, it's better to hide labels during transitions, so probably you just want to see if you have a transitionRenderData value, and hide all your labels if you do. See PlotSeries.updateDisplayList for an example of how to deal with transitions and render data. Ely.
[flexcoders] LinearAxis - need help with value ordering! (Repost with sample code)
Hi All, Any suggestions on how to get a numerical y-axis to start at the maximum value and descend on up? For example, the sample app below starts the y-axis at zero and goes up to 5; I want it to start at 5 and go up to zero: VerticalAxis.reverseDefaultSortOrder() or something. I've tried and failed with manipulating the baseAtZero, autoAdjust, minimum and maximum properties. Any ideas, kludgey or otherwise?? Many thanks! -Peter Demling Lexington, MA ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var sampleData:ArrayCollection = new ArrayCollection([ {xValue:10, yValue:1 }, {xValue:20, yValue:2 }, {xValue:30, yValue:3 }, {xValue:40, yValue:4 }, {xValue:50, yValue:5 } ]); ]] /mx:Script mx:LineChart width=100% height=100% dataProvider={sampleData} mx:verticalAxis mx:LinearAxis id=yAxis/ /mx:verticalAxis mx:series mx:LineSeries id=primaryLine xField=xValue yField=yValue/ /mx:series /mx:LineChart /mx:Application
[flexcoders] Re: LinearAxis - need help with value ordering! (Repost with sample code)
Hi Simon, Thanks for the reply. There are custom label functions for the various axes, but I need my datapoints to map to reverse order as well, so I don't think this would work. My best hack solution right now is to force a reverse by transforming the data in my dataProvider before charting it: in my case, I'm charting values 0-100, so I can do something like: invertedValue = value+((50-value)*2); Works, but I have to change the data itself, which is going to cause other problems. Ely's site is fabulous, but I didn't find an answer there in my searches. -Peter --- In flexcoders@yahoogroups.com, simonjpalmer [EMAIL PROTECTED] wrote: I'd look at using a custom renderer for the y-axis labels. I'm not exactly sure how but I am willing to bet that you can do it. Is there a label function or something similar on the LinearAxis? Have you poked around on Ely's blog (quietlyscheming.com) In the extreme case you can always create your own linear axis which handles the labelling. Simon --- In flexcoders@yahoogroups.com, Peter Demling pdemling@ wrote: Hi All, Any suggestions on how to get a numerical y-axis to start at the maximum value and descend on up? For example, the sample app below starts the y-axis at zero and goes up to 5; I want it to start at 5 and go up to zero: VerticalAxis.reverseDefaultSortOrder() or something. I've tried and failed with manipulating the baseAtZero, autoAdjust, minimum and maximum properties. Any ideas, kludgey or otherwise?? Many thanks! -Peter Demling Lexington, MA ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var sampleData:ArrayCollection = new ArrayCollection([ {xValue:10, yValue:1 }, {xValue:20, yValue:2 }, {xValue:30, yValue:3 }, {xValue:40, yValue:4 }, {xValue:50, yValue:5 } ]); ]] /mx:Script mx:LineChart width=100% height=100% dataProvider={sampleData} mx:verticalAxis mx:LinearAxis id=yAxis/ /mx:verticalAxis mx:series mx:LineSeries id=primaryLine xField=xValue yField=yValue/ /mx:series /mx:LineChart /mx:Application
[flexcoders] LinearAxis: override the default (ascending) order of numerical data?
I have a LinearAxis that's used in a LineChart to display a LineSeries, where the yField is a numeric value from 0-100. By default, it displays 0 at the x/y origin, and ascends up the y-axis to a max of 100. What I need to do is reverse that, so that the y-axis starts at 100 and ascends (visually) up to 0. Does anyone know how I might accomplish this? I've tried the following settings on LinearAxis, but it doesn't work: LinearAxis.baseAtZero=false; LinearAxis.autoAdjust=false; LinearAxis.minimum=100; LinearAxis.maximum=0; Same sort of question as: how do you display a dateTimeAxis in reverse time order? Or, how do you display a category axis in reverse (or custom) order?. LineSeries.sortOnXField=false apparently can force the x-axis order to tie to the order of the dataProvider; but I haven't yet found how to reverse the default sort on the y-axis. Many thanks! -Peter Demling Lexington, MA
[flexcoders] BP=?: 1 ArrayCollection, different selection criteria, same time
I have one ArrayCollection that holds all of the data I've retrieved from my (RemoteObject) data service, and I need to display it in 2 UI components, but with different filter conditions at the same time (e.g., imagine an ArrayCollection of SnackItems, where one DataGrid is showing you the CandyBars, and the other is showing you the FruitCups at the same time). I know I can accomplish this by creating a separate ArrayCollection for each UI component, and assigning them different filter functions - but is this best practice? It seems like I should be able to avoid copying my data in order to view it in different ways simultaneously. Could this involve creating multiple ViewCursors on the same ArrayCollection? Or am I overestimating the (performance/memory) cost of creating multiple ArrayCollections of the same source data? Thanks for any suggestions! -Peter Demling Lexington, MA
[flexcoders] DateTimeAxis problem: aligning dates with their year value
Experiencing an interesting problem with the DateTimeAxis. Below is the full code for a very simple LineChart app that's charting one data value across a DateTimeAxis (this a small variation of the DateTimeAxis example from livedocs). The date values for the DateTimeAxis are String values in a local ArrayCollection in the accepted MM/DD/ format. The problem is, all of the dates are getting charted one month too soon. This is especially apparent in this example, where all of the dates are on January 1st of each year: the data points are clearly lagging behind the year points on the x-axis (I added a verticalStroke here to show the discrepancy more clearly). If I change all of the data points to February-1st, they all get incorrectly drawn exactlty on the year-line. Any suggestions are appreciated! Thanks, -Peter Demling Lexington, MA ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; width=100% height=100% mx:Script![CDATA[ import mx.collections.ArrayCollection [Bindable] public var aapl:ArrayCollection = new ArrayCollection([ {date: 01/01/2001, close: 22.71}, {date: 01/01/2002, close: 12.71}, {date: 01/01/2003, close: 42.71}, {date: 01/01/2004, close: 52.99}, {date: 01/01/2005, close: 42.65}, {date: 01/01/2006, close: 62.65}, {date: 01/01/2007, close: 22.65}, {date: 01/01/2008, close: 72.65}, {date: 01/01/2009, close: 82.65} ]); ]]/mx:Script mx:Panel title=DateTimeAxis - Year alignment problem width=100% height=100% mx:LineChart id=mychart dataProvider={aapl} showDataTips=true height=100% width=100% mx:horizontalAxis mx:DateTimeAxis/ /mx:horizontalAxis mx:series mx:LineSeries yField=close xField=date displayName=AAPL/ /mx:series mx:backgroundElements mx:GridLines direction=vertical mx:verticalStroke mx:Stroke weight=3/ /mx:verticalStroke /mx:GridLines /mx:backgroundElements /mx:LineChart /mx:Panel /mx:Application
[flexcoders] Re: DateTimeAxis problem: aligning dates with their year value
That was it! I simply added displayLocalTime=true to my DateTimeAxis, and it works. Thanks very much, Ely! This charting API is the best. -Peter --- In flexcoders@yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] wrote: Peter...usually that's a problem of time zones. i.e., you're specifying your times in local time, and the DateTimeAxis is rendering in UTC. So Jan 1 in local time becomes Dec 31 in UTC, for example. Ely. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Peter Demling Sent: Monday, April 23, 2007 10:44 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] DateTimeAxis problem: aligning dates with their year value Experiencing an interesting problem with the DateTimeAxis. Below is the full code for a very simple LineChart app that's charting one data value across a DateTimeAxis (this a small variation of the DateTimeAxis example from livedocs). The date values for the DateTimeAxis are String values in a local ArrayCollection in the accepted MM/DD/ format. The problem is, all of the dates are getting charted one month too soon. This is especially apparent in this example, where all of the dates are on January 1st of each year: the data points are clearly lagging behind the year points on the x-axis (I added a verticalStroke here to show the discrepancy more clearly). If I change all of the data points to February-1st, they all get incorrectly drawn exactlty on the year-line. Any suggestions are appreciated! Thanks, -Peter Demling Lexington, MA ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; width=100% height=100% mx:Script![CDATA[ import mx.collections.ArrayCollection [Bindable] public var aapl:ArrayCollection = new ArrayCollection([ {date: 01/01/2001, close: 22.71}, {date: 01/01/2002, close: 12.71}, {date: 01/01/2003, close: 42.71}, {date: 01/01/2004, close: 52.99}, {date: 01/01/2005, close: 42.65}, {date: 01/01/2006, close: 62.65}, {date: 01/01/2007, close: 22.65}, {date: 01/01/2008, close: 72.65}, {date: 01/01/2009, close: 82.65} ]); ]]/mx:Script mx:Panel title=DateTimeAxis - Year alignment problem width=100% height=100% mx:LineChart id=mychart dataProvider={aapl} showDataTips=true height=100% width=100% mx:horizontalAxis mx:DateTimeAxis/ /mx:horizontalAxis mx:series mx:LineSeries yField=close xField=date displayName=AAPL/ /mx:series mx:backgroundElements mx:GridLines direction=vertical mx:verticalStroke mx:Stroke weight=3/ /mx:verticalStroke /mx:GridLines /mx:backgroundElements /mx:LineChart /mx:Panel /mx:Application
[flexcoders] Re: Will Microsoft's new Silverlight Player Kill our beloved Flex ?
Version 1 of Microsoft products have historically been slow, unapologizing in their copycat nature, and hampered by large numbers of major bugs and gaps in functionality. However, their astronomical cash reserves and relentless commitment to establish market share has almost always led to vastly improved products in version 2 and beyond. So of course, Silverlight is no match for Flex - right now. But if Microsoft sustains its commitment, it's not a question of *if* it could be almost as good as Flex - just a matter of when. I don't say this as a criticism of Microsoft (I use several of their products daily and love them), but rather to point out that they are more of a market force than a true software company - and so the relative success of Silverlight (or any other MS offering) is pre-ordained, so long as they decide that's what they want to do - it's independent of the present quality of the actual product. -Peter Demling Lexington, MA --- In flexcoders@yahoogroups.com, Scott Barnes [EMAIL PROTECTED] wrote: Claus, Yup, so that's why FLEX does have its unique offering vs SilverLight and once developers designers unsubscribe from the notion it's a Flash Killer and do more of what you are doing (exploring it's upcoming release) you'll decide on what you think it's merits are vs aren't. It's early days yet, so wouldn't worry to much about it folks ;) just keep an open mind should you want to take it for a test-run post MIX07 :) WPF SilverLight are going to have interesting prospects just like Apollo and FLEX will have it's own, I think the two will do different things for different people. Keep fingers in all barrels I'd say :) On 17 Apr 2007 03:30:22 -0700, Claus Wahlers [EMAIL PROTECTED] wrote: If you read FUD crap, ignore it on both sides and just be opened to the idea that theres yet another channel of delivery in rich interactive applications. Reading through the Silverlight docs, XAML looks to me like some weird kind of microsoftified SVG, spiced up with MP3 and WM codecs. I'm still searching but so far i couldn't find anything close to what Flex offers (what i found are some barely working and butt ugly component experiments). I'd guess that Silverlight will get some video market share, but it has a long way to go to enter the RIA market. My 2 centavos. Cheers, Claus. -- claus wahlers cĂ´deazur brasil http://codeazur.com.br/ http://wahlers.com.br/claus/blog/ -- Regards, Scott Barnes http://www.mossyblog.com
[flexcoders] FYI: my Flex ramp-up, training experience
Hi All, FYI, I just got back from Fig Leaf's 3-day Developing Rich Client Applications Flex course. Overall, I found it very beneficial. The most valuable part was the instructor's willingness to answer specific questions off-line, including Flex coding topics that were outside the scope of the immediate material (which in itself is a decent first-level cookbook). To that end, I think the best thing I did was to self-train for several weeks beforehand with Adobe's free Getting Started with Flex 2 guide, and I also took a stab at writing the first version of my app. That way I didn't waste my class time with novice-level, 101-type questions - I was able to get time-saving answers to real problems instead. In hindsight, the following were the best starting with Flex resources for me (and what I'll recommend to my co-workers), in rough logical order of use: - the 'intro to flex for java developers' online presentation by Bruce Eckel - the 'getting started with flex 2' guide (did all the excercises; pretty quick read) - the 'flex 2 developer's guide' - this forum - the flex 2 language reference at livedocs - the 3-day flex course In addition, the most persuasive resources that convinced me to go with Flex (as opposed to Ajax, primarily) were: - Bruce Eckel's article on the evolution of RIAs at http://ajax.sys-con.com/read/29.htm - The Component Explorer example at http://examples.adobe.com/flex2/inproduct/sdk/explorer/explorer.html - The Dashboard charting example at http://examples.adobe.com/flex2/inproduct/sdk/dashboard/dashboard.html Also, I thought the Conerates java test-drive was an appealing example for its simplicity, if you happen to come from a Java/Tomcat background: http://coenraets.org/blog/2007/01/flex-test-drive-server-for-java-developers-tomcat-based/ And while it covers a lot of the same info from the devleoper's guide and the fig leaf class workbook, I've also found Adobe's training from the source book to be useful. Curious to see if O'Reily's to-be-published 'Flex2 Cookbook' will cover any new ground... -Peter Demling Lexington, MA
[flexcoders] Re: Fascinating problem hiding columns in a DataGrid
Thanks, Michael - this initially didn't work, but it made me realize why some previous attempts of mine also failed: since RemoteObject is my dataProvider, I have to wait until the (asynchronous) call to this service completes, before doing any overrides in code after the service call; my earlier attempts changed the visible property immediately after the code line that invoked the RemoteObject - i.e., I had assumed the call was synchronous. So I set the result property of the RemoteObject to hideName(), with hideName() declared as follows (same thing your code does): private function hideName():void { myDataGrid.columns[0].visible = true; myDataGrid.columns[0].visible = false; } There's still an annoying screen flicker (as the column is very briefly visible), but it's a workaround. Glad to also hear that the next patch will fix this. Thanks again! This is a great forum. -Peter Demling Lexington, MA --- In flexcoders@yahoogroups.com, Michael Imhoff [EMAIL PROTECTED] wrote: Hi Peter, I recently posted about a very similar issue that might be of some help. Please take a look at http://michael.omnicypher.com/2007/03/issues-with-datagrid-column-visibility .html and let me know if that does the trick. Hope this helps, Michael _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of sanjaypmg Sent: Friday, March 16, 2007 1:43 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Fascinating problem hiding columns in a DataGrid Hi, I have done the same using remote object but didnt face this sort of problem. I am making the columns visible/invisible on the basis of value coming frm the database... Thanks Sanjay --- In [EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com ups.com, Peter Demling pdemling@ wrote: While a problem for me, I find the following behavior fascinating and inexplicable; so here's a good challenge for any Flexlock Holmes out there (full code is below - 26 lines, fairly simple): I have a DataGrid that's using a RemoteObject as its dataProvider, and I initialize the 'visible' propery of its first dataGridColumn to false. On startup, this column (labelled Name) is hidden - so far, so good. Next I click my GetData button to invoke the RemoteObject's service, and poof! The column becomes visible - even though the debugger verified that its visible property remains false! So now I click my HideName Button, which forcibly sets the visible property of this Name column to false. The debugger verifies that its false before I click it, and its false after I click it. Still, the column remains visible. So just for the heck of it I click my ShowName Button, which forcibly sets the visible property of the Name column to true. The debugger verifies that the value is changed to true - and as an added bonus, it increases the width of the Name column from 50 to 100! Okay... Finally, I click the HideName Button, and *this* time it works - the Name column is now hidden, having worked only after I forced its visible prpoerty to true immediately beforehand. I can replicate this ad nauseum (calling the RemoteObject service makes the hidden column visible without setting visible to true; forcing the visible value to false works only after forcing it to true), but it only happens when the dataProvider is remoteObject, and the forcing of the visible value only shows the column when done via Buttons (it does not work directly in code right after calling the RemoteObject service). Full code is below. I tracked every single Name column variable through the debugger, and nothing changes, except for visible and width as noted above. I did track down the moment that the ShowName button expands the column width (in Button.as, line 2050, function focusOutHandler), but I don't know enough about Flex yet to know why that would enable column hiding; or why the call to RemoteObject is revealing my invisible column in the first place, for that matter. Started out just wanting to hide some DataGrid columns, but went pretty far down the rabbit hole. Thanks for any input! -Peter Demling Lexington, MA ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml layout=absolute mx:RemoteObject id=srv destination=employees/ mx:DataGrid id=myDataGrid dataProvider={srv.getEmployees.lastResult} mx:columns mx:DataGridColumn visible=false headerText=Name dataField=name / mx:DataGridColumn headerText=Group dataField=group/ /mx:columns /mx:DataGrid mx:Button label=Get Data click=srv.getEmployees(); x=10 y=170/ mx:Button label=Hide name column click=myDataGrid.columns[0].visible=false; y=230 x=10/ mx:Button label=Show name column
[flexcoders] Fascinating problem hiding columns in a DataGrid
While a problem for me, I find the following behavior fascinating and inexplicable; so here's a good challenge for any Flexlock Holmes out there (full code is below - 26 lines, fairly simple): I have a DataGrid that's using a RemoteObject as its dataProvider, and I initialize the 'visible' propery of its first dataGridColumn to false. On startup, this column (labelled Name) is hidden - so far, so good. Next I click my GetData button to invoke the RemoteObject's service, and poof! The column becomes visible - even though the debugger verified that its visible property remains false! So now I click my HideName Button, which forcibly sets the visible property of this Name column to false. The debugger verifies that its false before I click it, and its false after I click it. Still, the column remains visible. So just for the heck of it I click my ShowName Button, which forcibly sets the visible property of the Name column to true. The debugger verifies that the value is changed to true - and as an added bonus, it increases the width of the Name column from 50 to 100! Okay... Finally, I click the HideName Button, and *this* time it works - the Name column is now hidden, having worked only after I forced its visible prpoerty to true immediately beforehand. I can replicate this ad nauseum (calling the RemoteObject service makes the hidden column visible without setting visible to true; forcing the visible value to false works only after forcing it to true), but it only happens when the dataProvider is remoteObject, and the forcing of the visible value only shows the column when done via Buttons (it does not work directly in code right after calling the RemoteObject service). Full code is below. I tracked every single Name column variable through the debugger, and nothing changes, except for visible and width as noted above. I did track down the moment that the ShowName button expands the column width (in Button.as, line 2050, function focusOutHandler), but I don't know enough about Flex yet to know why that would enable column hiding; or why the call to RemoteObject is revealing my invisible column in the first place, for that matter. Started out just wanting to hide some DataGrid columns, but went pretty far down the rabbit hole. Thanks for any input! -Peter Demling Lexington, MA ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:RemoteObject id=srv destination=employees/ mx:DataGrid id=myDataGrid dataProvider={srv.getEmployees.lastResult} mx:columns mx:DataGridColumn visible=false headerText=Name dataField=name / mx:DataGridColumn headerText=Group dataField=group/ /mx:columns /mx:DataGrid mx:Button label=Get Data click=srv.getEmployees(); x=10 y=170/ mx:Button label=Hide name column click=myDataGrid.columns[0].visible=false; y=230 x=10/ mx:Button label=Show name column click=myDataGrid.columns[0].visible=true; y=200 x=10/ /mx:Application
[flexcoders] Arrow-down/up event in non-editable DataGrid?
First-time hello Flexcoders, I have a non-editable DataGrid, and as the user arrows-down through the rows, I want to handle the event and do some stuff. The itemClick event only works for mouse-clicks on the rows; and itemFocusIn is only dispatched if the item is editable, so that doesn't work either. I tried directly data-binding a label in another control to the selectedItem in this DataGrid, and as I arrow-down through the list I can see it updating each time - so the event must be getting handled somewhere. Unfortunately, I want to do more than just data-binding when the user arrows-down through the list, so I need an event handler that captures this event. Any suggestions would be most welcome. Thanks! (Also, is there any recommended protocol on cross-posting topics here to Adobe's Flex 2 General Discussion forum?) -Peter Demling Lexington, MA
[flexcoders] Re: Arrow-down/up event in non-editable DataGrid?
Worked perfectly (I was looking closely at the item* events and missed this one). Thanks very much! -Peter Demling --- In flexcoders@yahoogroups.com, Clint Tredway [EMAIL PROTECTED] wrote: use the change event to do what you want. On 14 Mar 2007 07:18:52 -0700, Peter Demling [EMAIL PROTECTED] wrote: First-time hello Flexcoders, I have a non-editable DataGrid, and as the user arrows-down through the rows, I want to handle the event and do some stuff. The itemClick event only works for mouse-clicks on the rows; and itemFocusIn is only dispatched if the item is editable, so that doesn't work either. I tried directly data-binding a label in another control to the selectedItem in this DataGrid, and as I arrow-down through the list I can see it updating each time - so the event must be getting handled somewhere. Unfortunately, I want to do more than just data-binding when the user arrows-down through the list, so I need an event handler that captures this event. Any suggestions would be most welcome. Thanks! (Also, is there any recommended protocol on cross-posting topics here to Adobe's Flex 2 General Discussion forum?) -Peter Demling Lexington, MA -- http://indeegrumpee.spaces.live.com/