Reputation: 143
I want to emulate the datatip feature on google finance here - http://www.google.com/finance?q=INDE...EXNASDAQ:.IXIC
whereas the datatip does not appear over the chart when you hover over, but instead is anchored in the top right header of the chart. How do I go about doing this? Thx in advance!
tone
Upvotes: 0
Views: 342
Reputation: 12847
How I would do it is to have the chart component handle mousemove and retreive where the mouse is relative to the data and store that single data point into a property like mouseOverData
which is then binded to another component, like that top 'tooltip'. Here's an example of the flattened components (flattened because I would make separate files for each component for ability to reuse in my project):
<s:VGroup>
<s:HGroup>
<s:Label text="Some Label: {mouseOverData.someProperty}" />
<s:Label text="Second Label: {mouseOverData.secondProperty}" />
</s:HGroup>
<mx:LineChart mouseMove="calculateMousePositionRelativeToDataAndStoreInMouseOverDataProp(event)" />
</s:VGroup>
Upvotes: 1