Re: [flexcoders] Re: Hands-on charts

2006-11-29 Thread Tom Fitzpatrick
Mark -

Thanks - I'll take a look at that.

- Tom

mark_g_wales wrote:



 Tom,

 I tried to take an excerpt of some existing code so there may be more
 imports, etc. that are needed. Hopefully this is the effect you were
 looking for...

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml 
 http://www.adobe.com/2006/mxml xmlns:local=*

 mx:Script
 ![CDATA[
 import mx.containers.HBox;
 import mx.containers.Panel;
 import mx.controls.Label;
 import mx.controls.Spacer;
 import mx.controls.sliderClasses.Slider;
 import mx.events.IndexChangedEvent;
 import mx.events.SliderEvent;
 import mx.controls.HSlider;

 public var oldValue:int = 0;
 public var criteria:Array = new Array();
 public var criteriaValues:Array = new Array();

 public function addSlider():void {
 var hbox:HBox = new HBox();
 vbox.addChild(hbox);

 var hslider:HSlider = new HSlider();
 hslider.id = new String(criteria.length);
 hslider.width = 400;
 hslider.height = 20;
 hslider.maximum = 100;
 hslider.liveDragging = true;
 hslider.setStyle(trackColors, [0x99, 0x99]);
 hslider.addEventListener(SliderEvent.CHANGE, slideControl);
 var sliderDO:DisplayObject = vbox.addChild(hslider);
 criteria.push(sliderDO);

 var hsliderValue:Label = new Label();
 hsliderValue.id = new String(criteria.length);
 hsliderValue.htmlText = font size='18'0/font;
 var hsliderValueDO:DisplayObject = hbox.addChild(hsliderValue);
 criteriaValues.push(hsliderValueDO);

 var spacer:Spacer = new Spacer();
 spacer.height = 50;
 vbox.addChild(spacer);
 }

 public function slideControl(event:SliderEvent):void {

 var currentSlider:int = new Number(event.target.id);

 // Redraw the box for the slider on each change/move
 vbox.graphics.beginFill(0x99, 1.0);
 vbox.graphics.drawRect(event.target.x, event.target.y,
 event.target.width, 20);
 vbox.graphics.beginFill(0xffcc00, 1.0);
 vbox.graphics.drawRect(event.target.x, event.target.y, event.value
 * .01 * event.target.width, 20);

 // Set display value for currently selected slider
 var sliderValue:String = new String(event.value).substr(0,2);
 criteriaValues[currentSlider].htmlText = font size='18' + new
 String(event.value).substr(0,2) + /font;
 }

 ]]
 /mx:Script

 mx:VBox id=vbox height=50% width=100% 
 mx:Button label=Add Slider click=addSlider() /
 mx:Spacer height=50 /
 /mx:VBox

 /mx:Application

  From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com] On
  Behalf Of Tom Fitzpatrick
  Sent: Monday, November 27, 2006 6:34 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
  Subject: [flexcoders] Hands-on charts
 
  Flex charts work beautifully responding to dynamic changes in data.
 
  Using the current components, is there any way to use Flex charts to
  change data?
 
  As a conceptual model, I'm thinking of the way parametric equalizers
  work in some audio programs, where it's possible to drag nodes on a
  line
 
  graph vertically or horizontally to change the parametric data.
 
  - Tom

  





Re: [flexcoders] Re: Hands-on charts

2006-11-29 Thread Tom Fitzpatrick
Ely -

Inching forward some more...

I implemented your tracking code (very clever) but it's still unclear 
how to use the Point data to rebuild the dataProvider. What is the hook 
that lets the function know which item in the dataProvider array is 
associated with the point data?

- Tom


Ely Greenfield wrote:
  
  
 Yup. To do mouse tracking, you generally need a mouse down, mouse 
 move, and mouse up handler.  Almost all of my code that does mouse 
 tracking looks like this:
  
  
 someComponent mouseDown=startTracking(event); /
  
  
 private function startTracking(e:MouseEvent):void
 {
 // listen to the systemManager so we get mouse move/up events even 
 when the mouse moves outside the component.
 // listen on capture so we can cancel move/rollover events going 
 to other components.
 systemManager.addEventListener(MouseEvent.MOUSE_MOVE,track,true);
 systemManager.addEventListener(MouseEvent.MOUSE_UP,endTracking,true);
 track(e);
 }
  
 private function track(e:MouseEvent):void
 {
 // update your data/UI here.
 }
  
 private function endTracking(e:MouseEvent):void
 {
 track(e);

 // remove the event listeners until we need to track again.
 systemManager.removeEventListener(MouseEvent.MOUSE_MOVE,track,true);
 
 systemManager.removeEventListener(MouseEvent.MOUSE_UP,endTracking,true);

 }
  

 
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 *On Behalf Of *Tom Fitzpatrick
 *Sent:* Tuesday, November 28, 2006 9:37 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] Re: Hands-on charts

 I'm trying out your suggested approach and ran into a conceptual
 problem. I can get the mouse coordinates and convert them to data on the
 mouseDown event - but then how do I track the mouse movement, since that
 uses a different event (mouseMove), and the function I'm working with is
 already tied to the mouseDown? The movement tracking seems necessary to
 get the new coordinates.

 - Tom

 Ely Greenfield wrote:
 
 
 
  It depends on just how much data you're trying to show in the chart,
  but chances are good that it will be very responsive.
 
  Ely.
 
 
  --
  *From:* flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com]
  *On Behalf Of *tom24569
  *Sent:* Monday, November 27, 2006 12:08 PM
  *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  *Subject:* [flexcoders] Re: Hands-on charts
 
  Would this happen fast enough that the chart would seem to be
  responding to the mouse movement?
 
  - Tom
 
  --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com, Ely Greenfield [EMAIL PROTECTED]
  wrote:
  
  
  
   Hi Tom. There's no interative modelling built in, but this should be
   pretty easy to do:
  
   1) listen for itemMouseDown events.
   2) track the mouse position
   3) convert the mouse position into data coordinates using the
   chart.localToData() function.
   4) write the new data coordinates into your dataProvider
  
  
   Ely.
  
  
   
  
   From: flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com] On
   Behalf Of Tom Fitzpatrick
   Sent: Monday, November 27, 2006 6:34 AM
   To: flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
   Subject: [flexcoders] Hands-on charts
  
  
  
   Flex charts work beautifully responding to dynamic changes in data.
  
   Using the current components, is there any way to use Flex charts to
   change data?
  
   As a conceptual model, I'm thinking of the way parametric equalizers
   work in some audio programs, where it's possible to drag nodes on 
 a line
  
   graph vertically or horizontally to change the parametric data.
  
   - Tom
  
 
 

  






RE: [flexcoders] Re: Hands-on charts

2006-11-29 Thread Ely Greenfield
 
 
 
That depends on what you're trying to do specifically.
 
The easy answer would be to say that this only works when the user
specifically clicks down and drags on an item in the chart.
 
In that case, I'd modify my example below by:
 
1) listen to the chart's itemMouseDown event instead of mouseDown
2) change the type of the event object in the mouse down handler to
ChartMouseEvent
3) in the event object, there will be a hitData property. That should
tell you which item in your dataProvider you should be updating.
4) store off a reference to that item.
5) in your track function, use localToData to convert mouse coordinates
to data coordinates
6) in track function, write those data coordinates back into the item
you stored off.
 
Ely.
 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Fitzpatrick
Sent: Wednesday, November 29, 2006 9:31 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Hands-on charts



Ely -

Inching forward some more...

I implemented your tracking code (very clever) but it's still unclear 
how to use the Point data to rebuild the dataProvider. What is the hook 
that lets the function know which item in the dataProvider array is 
associated with the point data?

- Tom

Ely Greenfield wrote:
 
 
 Yup. To do mouse tracking, you generally need a mouse down, mouse 
 move, and mouse up handler. Almost all of my code that does mouse 
 tracking looks like this:
 
 
 someComponent mouseDown=startTracking(event); /
 
 
 private function startTracking(e:MouseEvent):void
 {
 // listen to the systemManager so we get mouse move/up events even 
 when the mouse moves outside the component.
 // listen on capture so we can cancel move/rollover events going 
 to other components.
 systemManager.addEventListener(MouseEvent.MOUSE_MOVE,track,true);
 systemManager.addEventListener(MouseEvent.MOUSE_UP,endTracking,true);
 track(e);
 }
 
 private function track(e:MouseEvent):void
 {
 // update your data/UI here.
 }
 
 private function endTracking(e:MouseEvent):void
 {
 track(e);
 
 // remove the event listeners until we need to track again.
 systemManager.removeEventListener(MouseEvent.MOUSE_MOVE,track,true);
 

systemManager.removeEventListener(MouseEvent.MOUSE_UP,endTracking,true);


 }
 

 --
 *From:* flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] 
 *On Behalf Of *Tom Fitzpatrick
 *Sent:* Tuesday, November 28, 2006 9:37 AM
 *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com

 *Subject:* Re: [flexcoders] Re: Hands-on charts

 I'm trying out your suggested approach and ran into a conceptual
 problem. I can get the mouse coordinates and convert them to data on
the
 mouseDown event - but then how do I track the mouse movement, since
that
 uses a different event (mouseMove), and the function I'm working with
is
 already tied to the mouseDown? The movement tracking seems necessary
to
 get the new coordinates.

 - Tom

 Ely Greenfield wrote:
 
 
 
  It depends on just how much data you're trying to show in the chart,
  but chances are good that it will be very responsive.
 
  Ely.
 
 
  --
  *From:* flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  
 mailto:flexcoders%40yahoogroups.com 
 [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com]
  *On Behalf Of *tom24569
  *Sent:* Monday, November 27, 2006 12:08 PM
  *To:* flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com
  *Subject:* [flexcoders] Re: Hands-on charts
 
  Would this happen fast enough that the chart would seem to be
  responding to the mouse movement?
 
  - Tom
 
  --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com, Ely Greenfield
[EMAIL PROTECTED]
  wrote:
  
  
  
   Hi Tom. There's no interative modelling built in, but this should
be
   pretty easy to do:
  
   1) listen for itemMouseDown events.
   2) track the mouse position
   3) convert the mouse position into data coordinates using the
   chart.localToData() function.
   4) write the new data coordinates into your dataProvider
  
  
   Ely.
  
  
   
  
   From: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com] On
   Behalf Of Tom Fitzpatrick
   Sent: Monday, November 27, 2006 6:34 AM
   To: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  
 mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com

Re: [flexcoders] Re: Hands-on charts

2006-11-29 Thread Tom Fitzpatrick
Ely -

Do you mean ChartItemEvent? I can't find ChartMouseEvent documented. 
ChartItemEvent gives me the HitData and access to the item, but I seem 
to lose the mouse tracking in the process.

- Tom

Ely Greenfield wrote:

  
  
  
 That depends on what you're trying to do specifically.
  
 The easy answer would be to say that this only works when the user 
 specifically clicks down and drags on an item in the chart.
  
 In that case, I'd modify my example below by:
  
 1) listen to the chart's itemMouseDown event instead of mouseDown
 2) change the type of the event object in the mouse down handler to 
 ChartMouseEvent
 3) in the event object, there will be a hitData property. That should 
 tell you which item in your dataProvider you should be updating.
 4) store off a reference to that item.
 5) in your track function, use localToData to convert mouse 
 coordinates to data coordinates
 6) in track function, write those data coordinates back into the item 
 you stored off.
  
 Ely.
  

 
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 *On Behalf Of *Tom Fitzpatrick
 *Sent:* Wednesday, November 29, 2006 9:31 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] Re: Hands-on charts

 Ely -

 Inching forward some more...

 I implemented your tracking code (very clever) but it's still unclear
 how to use the Point data to rebuild the dataProvider. What is the hook
 that lets the function know which item in the dataProvider array is
 associated with the point data?

 - Tom

 Ely Greenfield wrote:
 
 
  Yup. To do mouse tracking, you generally need a mouse down, mouse
  move, and mouse up handler. Almost all of my code that does mouse
  tracking looks like this:
 
 
  someComponent mouseDown=startTracking(event); /
 
 
  private function startTracking(e:MouseEvent):void
  {
  // listen to the systemManager so we get mouse move/up events even
  when the mouse moves outside the component.
  // listen on capture so we can cancel move/rollover events going
  to other components.
  systemManager.addEventListener(MouseEvent.MOUSE_MOVE,track,true);
  systemManager.addEventListener(MouseEvent.MOUSE_UP,endTracking,true);
  track(e);
  }
 
  private function track(e:MouseEvent):void
  {
  // update your data/UI here.
  }
 
  private function endTracking(e:MouseEvent):void
  {
  track(e);
 
  // remove the event listeners until we need to track again.
  systemManager.removeEventListener(MouseEvent.MOUSE_MOVE,track,true);
 
  
 systemManager.removeEventListener(MouseEvent.MOUSE_UP,endTracking,true);
 
  }
 
 
  --
  *From:* flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com]
  *On Behalf Of *Tom Fitzpatrick
  *Sent:* Tuesday, November 28, 2006 9:37 AM
  *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  *Subject:* Re: [flexcoders] Re: Hands-on charts
 
  I'm trying out your suggested approach and ran into a conceptual
  problem. I can get the mouse coordinates and convert them to data on the
  mouseDown event - but then how do I track the mouse movement, since that
  uses a different event (mouseMove), and the function I'm working with is
  already tied to the mouseDown? The movement tracking seems necessary to
  get the new coordinates.
 
  - Tom
 
  Ely Greenfield wrote:
  
  
  
   It depends on just how much data you're trying to show in the chart,
   but chances are good that it will be very responsive.
  
   Ely.
  
  
   --
   *From:* flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com]
   *On Behalf Of *tom24569
   *Sent:* Monday, November 27, 2006 12:08 PM
   *To:* flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
   *Subject:* [flexcoders] Re: Hands-on charts
  
   Would this happen fast enough that the chart would seem to be
   responding to the mouse movement?
  
   - Tom
  
   --- In flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
   mailto:flexcoders%40yahoogroups.com, Ely Greenfield [EMAIL 
   PROTECTED]
   wrote:
   
   
   
Hi Tom. There's no interative modelling built in, but this should be
pretty easy to do:
   
1) listen for itemMouseDown events.
2) track the mouse position
3) convert the mouse position into data coordinates using the
chart.localToData() function.
4) write the new data coordinates into your dataProvider
   
   
Ely.
   
   

   
From: flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders

Re: [flexcoders] Re: Hands-on charts

2006-11-28 Thread Tom Fitzpatrick
I'm trying out your suggested approach and ran into a conceptual 
problem. I can get the mouse coordinates and convert them to data on the 
mouseDown event - but then how do I track the mouse movement, since that 
uses a different event (mouseMove), and the function I'm working with is 
already tied to the mouseDown? The movement tracking seems necessary to 
get the new coordinates.

- Tom

Ely Greenfield wrote:

  
  
 It depends on just how much data you're trying to show in the chart, 
 but chances are good that it will be very responsive.
  
 Ely.
  

 
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 *On Behalf Of *tom24569
 *Sent:* Monday, November 27, 2006 12:08 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] Re: Hands-on charts

 Would this happen fast enough that the chart would seem to be
 responding to the mouse movement?

 - Tom

 --- In flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] 
 wrote:
 
 
 
  Hi Tom. There's no interative modelling built in, but this should be
  pretty easy to do:
 
  1) listen for itemMouseDown events.
  2) track the mouse position
  3) convert the mouse position into data coordinates using the
  chart.localToData() function.
  4) write the new data coordinates into your dataProvider
 
 
  Ely.
 
 
  
 
  From: flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com] On
  Behalf Of Tom Fitzpatrick
  Sent: Monday, November 27, 2006 6:34 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  Subject: [flexcoders] Hands-on charts
 
 
 
  Flex charts work beautifully responding to dynamic changes in data.
 
  Using the current components, is there any way to use Flex charts to
  change data?
 
  As a conceptual model, I'm thinking of the way parametric equalizers
  work in some audio programs, where it's possible to drag nodes on a line
 
  graph vertically or horizontally to change the parametric data.
 
  - Tom
 

  





RE: [flexcoders] Re: Hands-on charts

2006-11-28 Thread Ely Greenfield
 
 
Yup. To do mouse tracking, you generally need a mouse down, mouse move,
and mouse up handler.  Almost all of my code that does mouse tracking
looks like this:
 
 
someComponent mouseDown=startTracking(event); /
 
 
private function startTracking(e:MouseEvent):void
{
// listen to the systemManager so we get mouse move/up events even
when the mouse moves outside the component.
// listen on capture so we can cancel move/rollover events going to
other components.
systemManager.addEventListener(MouseEvent.MOUSE_MOVE,track,true);
 
systemManager.addEventListener(MouseEvent.MOUSE_UP,endTracking,true);

track(e);
}
 
private function track(e:MouseEvent):void
{
// update your data/UI here.
}
 
private function endTracking(e:MouseEvent):void
{
track(e);

// remove the event listeners until we need to track again.
systemManager.removeEventListener(MouseEvent.MOUSE_MOVE,track,true);
 
systemManager.removeEventListener(MouseEvent.MOUSE_UP,endTracking,true);

}
 




From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Fitzpatrick
Sent: Tuesday, November 28, 2006 9:37 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Hands-on charts



I'm trying out your suggested approach and ran into a conceptual 
problem. I can get the mouse coordinates and convert them to data on the

mouseDown event - but then how do I track the mouse movement, since that

uses a different event (mouseMove), and the function I'm working with is

already tied to the mouseDown? The movement tracking seems necessary to 
get the new coordinates.

- Tom

Ely Greenfield wrote:

 
 
 It depends on just how much data you're trying to show in the chart, 
 but chances are good that it will be very responsive.
 
 Ely.
 

 --
 *From:* flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] 
 *On Behalf Of *tom24569
 *Sent:* Monday, November 27, 2006 12:08 PM
 *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com

 *Subject:* [flexcoders] Re: Hands-on charts

 Would this happen fast enough that the chart would seem to be
 responding to the mouse movement?

 - Tom

 --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  
 mailto:flexcoders%40yahoogroups.com, Ely Greenfield [EMAIL PROTECTED]

 wrote:
 
 
 
  Hi Tom. There's no interative modelling built in, but this should be
  pretty easy to do:
 
  1) listen for itemMouseDown events.
  2) track the mouse position
  3) convert the mouse position into data coordinates using the
  chart.localToData() function.
  4) write the new data coordinates into your dataProvider
 
 
  Ely.
 
 
  
 
  From: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  
 mailto:flexcoders%40yahoogroups.com 
 [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  
 mailto:flexcoders%40yahoogroups.com] On
  Behalf Of Tom Fitzpatrick
  Sent: Monday, November 27, 2006 6:34 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com
  Subject: [flexcoders] Hands-on charts
 
 
 
  Flex charts work beautifully responding to dynamic changes in data.
 
  Using the current components, is there any way to use Flex charts to
  change data?
 
  As a conceptual model, I'm thinking of the way parametric equalizers
  work in some audio programs, where it's possible to drag nodes on a
line
 
  graph vertically or horizontally to change the parametric data.
 
  - Tom
 

 



 


Re: [flexcoders] Re: Hands-on charts

2006-11-28 Thread Tom Fitzpatrick
I'm trying to use a chart to do this because the data are currently 
displayed in charts, so that seemed the most appropriate control to use 
for making data changes.

That said, I'd be very interested in seeing how you implemented this. 
Any chance of sharing your code?

- Tom

mark_g_wales wrote:


 Tom,

 I'm not sure if you are stuck on using charts to do this, but I think
 I accomplished a similar effect to what you want a while back by using
 the graphics package to draw a rectangle around a slider. I listened
 for slider events and would then clear and re-run the drawRect on each
 move. It was very little code and the effect was quite seamless.

 -Mark

 --- In flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] 
 wrote:
 
 
 
  Yup. To do mouse tracking, you generally need a mouse down, mouse move,
  and mouse up handler. Almost all of my code that does mouse tracking
  looks like this:
 
 
  someComponent mouseDown=startTracking(event); /
 
 
  private function startTracking(e:MouseEvent):void
  {
  // listen to the systemManager so we get mouse move/up events even
  when the mouse moves outside the component.
  // listen on capture so we can cancel move/rollover events going to
  other components.
  systemManager.addEventListener(MouseEvent.MOUSE_MOVE,track,true);
 
  systemManager.addEventListener(MouseEvent.MOUSE_UP,endTracking,true);
 
  track(e);
  }
 
  private function track(e:MouseEvent):void
  {
  // update your data/UI here.
  }
 
  private function endTracking(e:MouseEvent):void
  {
  track(e);
 
  // remove the event listeners until we need to track again.
  systemManager.removeEventListener(MouseEvent.MOUSE_MOVE,track,true);
 
  systemManager.removeEventListener(MouseEvent.MOUSE_UP,endTracking,true);
 
  }
 
 
 
  
 
  From: flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com] On
  Behalf Of Tom Fitzpatrick
  Sent: Tuesday, November 28, 2006 9:37 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  Subject: Re: [flexcoders] Re: Hands-on charts
 
 
 
  I'm trying out your suggested approach and ran into a conceptual
  problem. I can get the mouse coordinates and convert them to data on the
 
  mouseDown event - but then how do I track the mouse movement, since that
 
  uses a different event (mouseMove), and the function I'm working with is
 
  already tied to the mouseDown? The movement tracking seems necessary to
  get the new coordinates.
 
  - Tom
 
  Ely Greenfield wrote:
  
  
  
   It depends on just how much data you're trying to show in the chart,
   but chances are good that it will be very responsive.
  
   Ely.
  
  
   --
   *From:* flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  ]
   *On Behalf Of *tom24569
   *Sent:* Monday, November 27, 2006 12:08 PM
   *To:* flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
 
   *Subject:* [flexcoders] Re: Hands-on charts
  
   Would this happen fast enough that the chart would seem to be
   responding to the mouse movement?
  
   - Tom
  
   --- In flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
   mailto:flexcoders%40yahoogroups.com, Ely Greenfield egreenfi@
 
   wrote:
   
   
   
Hi Tom. There's no interative modelling built in, but this should be
pretty easy to do:
   
1) listen for itemMouseDown events.
2) track the mouse position
3) convert the mouse position into data coordinates using the
chart.localToData() function.
4) write the new data coordinates into your dataProvider
   
   
Ely.
   
   

   
From: flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
   mailto:flexcoders%40yahoogroups.com
   [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
   mailto:flexcoders%40yahoogroups.com] On
Behalf Of Tom Fitzpatrick
Sent: Monday, November 27, 2006 6:34 AM
To: flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
Subject: [flexcoders] Hands-on charts
   
   
   
Flex charts work beautifully responding to dynamic changes in data.
   
Using the current components, is there any way to use Flex charts to
change data?
   
As a conceptual model, I'm thinking of the way parametric equalizers
work in some audio programs, where it's possible to drag nodes on a
  line
   
graph vertically or horizontally to change

RE: [flexcoders] Re: Hands-on charts

2006-11-27 Thread Ely Greenfield
 
 
It depends on just how much data you're trying to show in the chart, but
chances are good that it will be very responsive.
 
Ely.
 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of tom24569
Sent: Monday, November 27, 2006 12:08 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Hands-on charts



Would this happen fast enough that the chart would seem to be
responding to the mouse movement?

- Tom

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Ely Greenfield [EMAIL PROTECTED] wrote:

 
 
 Hi Tom. There's no interative modelling built in, but this should be
 pretty easy to do:
 
 1) listen for itemMouseDown events.
 2) track the mouse position
 3) convert the mouse position into data coordinates using the
 chart.localToData() function.
 4) write the new data coordinates into your dataProvider
 
 
 Ely.
 
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of Tom Fitzpatrick
 Sent: Monday, November 27, 2006 6:34 AM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] Hands-on charts
 
 
 
 Flex charts work beautifully responding to dynamic changes in data.
 
 Using the current components, is there any way to use Flex charts to 
 change data?
 
 As a conceptual model, I'm thinking of the way parametric equalizers 
 work in some audio programs, where it's possible to drag nodes on a
line
 
 graph vertically or horizontally to change the parametric data.
 
 - Tom