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> > > > 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 > > > > > > > > >