[flexcoders] Re: Dynamic Min/Max for chart axis not updating automatically.
Can this be done? --- In flexcoders@yahoogroups.com, polonycjunk [EMAIL PROTECTED] wrote: Hi Ely, Sorry if I confused you. If I let flex handle the min/max value, I am not getting the time axis I'm looking. Say for example, the current time is 4:01:00. Consider a collection with size = 60. It consists of data for the last 60 seconds. If I let flex handle it, the h-axis will only show 4:00:00 to 4:01:00. But what I really want is for the h-axis to show the time from 4:00:00(min) to 4:03:00 (max) (T+3minutes). As more data arrives each second, I want the min and max to change to reflect the times that are in the collection. Once I assign a min/max to the chart, is there a way to update it according to new values in the dataProvider? The only way I was able to make it change was if I created a button which sets a new Min/Max. I would need to consistently click on the button to create the moving window of (T + 3). --- In flexcoders@yahoogroups.com, Ely Greenfield egreenfi@ wrote: I'm a little confused by your question. If you're explicitly assigning a min/max value, you're telling the chart you don't want it to generate automatic min/max values. If you're asking how to remove your previously assigned min/max and ask it to restart automatically generating min/max values, just set the min/max of the axis to undefined. Ely. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of polonycjunk Sent: Wednesday, December 06, 2006 9:42 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Dynamic Min/Max for chart axis not updating automatically. Once a minimum/maximum value is assigned to the DateTimeAxis, how can i get a realtime chart to update the min/max values depending on its dataProvider and keep it updating? Here is some code to illustrate: Note: dataProvider is an ArrayCollection of size 100. if size = 100, the date at index 0 is removed and the next date is added. private var _minimum:Date=null; [Bindable] public function get minimum():Date{ if(this.dataProvider == null){ _minimum = new Date(); _minimum.setHours(9,0,0,0); }else{ _minimum = this.dataProvider.getItemAt(0).date; } return _minimum; } private var _maximum:Date=null; [Bindable] public function get maximum():Date{ if(this.dataProvider == null){ _maximum = new Date(); _maximum.setHours(16,0,0,0); }else{ if(_zoomLevel == seconds){ _maximum.setHours(_minimum.hours, _minimum.minutes +3, _minimum.seconds,_minimum.milliseconds); //I want my maximum to change whenever my minimum changes. } } return _maximum; } MXML code: mx:horizontalAxis mx:DateTimeAxis id=hTimeAxis labelUnits=minutes dataUnits=minutes interval=20 displayLocalTime=true alignLabelsToUnits=true minimum={minimum} maximum={maximum} / /mx:horizontalAxis
RE: [flexcoders] Re: Dynamic Min/Max for chart axis not updating automatically.
Are you asking how to detect changes in your dataprovider? The answer is yes, sort of. But it really depends on your app and where the data is coming from. IN general, I would say that this is application dependent. A very simple code example would help us know how to guide you. Ely. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of polonycjunk Sent: Thursday, December 07, 2006 7:12 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Dynamic Min/Max for chart axis not updating automatically. Can this be done? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , polonycjunk [EMAIL PROTECTED] wrote: Hi Ely, Sorry if I confused you. If I let flex handle the min/max value, I am not getting the time axis I'm looking. Say for example, the current time is 4:01:00. Consider a collection with size = 60. It consists of data for the last 60 seconds. If I let flex handle it, the h-axis will only show 4:00:00 to 4:01:00. But what I really want is for the h-axis to show the time from 4:00:00(min) to 4:03:00 (max) (T+3minutes). As more data arrives each second, I want the min and max to change to reflect the times that are in the collection. Once I assign a min/max to the chart, is there a way to update it according to new values in the dataProvider? The only way I was able to make it change was if I created a button which sets a new Min/Max. I would need to consistently click on the button to create the moving window of (T + 3). --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Ely Greenfield egreenfi@ wrote: I'm a little confused by your question. If you're explicitly assigning a min/max value, you're telling the chart you don't want it to generate automatic min/max values. If you're asking how to remove your previously assigned min/max and ask it to restart automatically generating min/max values, just set the min/max of the axis to undefined. Ely. From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of polonycjunk Sent: Wednesday, December 06, 2006 9:42 AM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Dynamic Min/Max for chart axis not updating automatically. Once a minimum/maximum value is assigned to the DateTimeAxis, how can i get a realtime chart to update the min/max values depending on its dataProvider and keep it updating? Here is some code to illustrate: Note: dataProvider is an ArrayCollection of size 100. if size = 100, the date at index 0 is removed and the next date is added. private var _minimum:Date=null; [Bindable] public function get minimum():Date{ if(this.dataProvider == null){ _minimum = new Date(); _minimum.setHours(9,0,0,0); }else{ _minimum = this.dataProvider.getItemAt(0).date; } return _minimum; } private var _maximum:Date=null; [Bindable] public function get maximum():Date{ if(this.dataProvider == null){ _maximum = new Date(); _maximum.setHours(16,0,0,0); }else{ if(_zoomLevel == seconds){ _maximum.setHours(_minimum.hours, _minimum.minutes +3, _minimum.seconds,_minimum.milliseconds); //I want my maximum to change whenever my minimum changes. } } return _maximum; } MXML code: mx:horizontalAxis mx:DateTimeAxis id=hTimeAxis labelUnits=minutes dataUnits=minutes interval=20 displayLocalTime=true alignLabelsToUnits=true minimum={minimum} maximum={maximum} / /mx:horizontalAxis
[flexcoders] Re: Dynamic Min/Max for chart axis not updating automatically.
Hi Ely, Sorry if I confused you. If I let flex handle the min/max value, I am not getting the time axis I'm looking. Say for example, the current time is 4:01:00. Consider a collection with size = 60. It consists of data for the last 60 seconds. If I let flex handle it, the h-axis will only show 4:00:00 to 4:01:00. But what I really want is for the h-axis to show the time from 4:00:00(min) to 4:03:00 (max) (T+3minutes). As more data arrives each second, I want the min and max to change to reflect the times that are in the collection. Once I assign a min/max to the chart, is there a way to update it according to new values in the dataProvider? The only way I was able to make it change was if I created a button which sets a new Min/Max. I would need to consistently click on the button to create the moving window of (T + 3). --- In flexcoders@yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] wrote: I'm a little confused by your question. If you're explicitly assigning a min/max value, you're telling the chart you don't want it to generate automatic min/max values. If you're asking how to remove your previously assigned min/max and ask it to restart automatically generating min/max values, just set the min/max of the axis to undefined. Ely. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of polonycjunk Sent: Wednesday, December 06, 2006 9:42 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Dynamic Min/Max for chart axis not updating automatically. Once a minimum/maximum value is assigned to the DateTimeAxis, how can i get a realtime chart to update the min/max values depending on its dataProvider and keep it updating? Here is some code to illustrate: Note: dataProvider is an ArrayCollection of size 100. if size = 100, the date at index 0 is removed and the next date is added. private var _minimum:Date=null; [Bindable] public function get minimum():Date{ if(this.dataProvider == null){ _minimum = new Date(); _minimum.setHours(9,0,0,0); }else{ _minimum = this.dataProvider.getItemAt(0).date; } return _minimum; } private var _maximum:Date=null; [Bindable] public function get maximum():Date{ if(this.dataProvider == null){ _maximum = new Date(); _maximum.setHours(16,0,0,0); }else{ if(_zoomLevel == seconds){ _maximum.setHours(_minimum.hours, _minimum.minutes +3, _minimum.seconds,_minimum.milliseconds); //I want my maximum to change whenever my minimum changes. } } return _maximum; } MXML code: mx:horizontalAxis mx:DateTimeAxis id=hTimeAxis labelUnits=minutes dataUnits=minutes interval=20 displayLocalTime=true alignLabelsToUnits=true minimum={minimum} maximum={maximum} / /mx:horizontalAxis