Is there a way to capture when the latestObservation graphic is updated by the TemporalRenderer?

3405
3
12-09-2014 09:14 PM
CarisaSmith
New Contributor III

Is there a way to capture when the latestObservation graphic is updated by the TemporalRenderer?  Using the TemporalRenderer with a FeatureLayer populated by a featureCollectionObject, can I capture the event when the latest graphic is updated on the map?  I would like to update a table with that graphic's latest attributes.  I can use the "graphic-draw" event, yet this only occurs if that graphic is visible in the current map extent and not all graphics that are being updated at that given time.  Plus, the "graphic-draw" event captures my historic graphics as well as the latest graphic.  The feature layer's "update-end" fires for each graphic also, yet how do you know which graphic was updated in that event?  The "graphic-add" does not help either, since all my graphics are loaded to the map at one time and then displayed via the TemporalRenderer.  Any ideas?  Thanks! 

3 Replies
HeikoHeijenga
Esri Contributor

One approach would be to check which graphics satisfy the current time extent in each map.time-extent-change event and then extract the 'newest' graphic. If you then store a reference to this graphic and compare it each time this event fires you can figure out if the 'newest' graphic changed.

CarisaSmith
New Contributor III

Thanks, Helko!  The map time-extent-change event works yet if I slide the slider in reverse, I wouldn't get the updates to the table until I played the slider again.  So, I was able to get it working, yet not sure if it's the most efficient.  For the time-extent-change for the TimeSlider, I'm grabbing all the graphics that are visible with my feature layer and putting them into a key object based on my unique field... so the last one added to the object is the 'newest' graphic.  Then update those graphic attributes in my table.  Thanks for giving me the idea!  - Carisa

0 Kudos
CarisaSmith
New Contributor III

Hi, Heiko!  Do you have a better idea on how to extract the 'newest' graphic without looping thru all the graphics and finding the last one?  If a user grabs data from the entire day, there can be more than 3k records.  This slows down on each time-extent-change if I'm looping thru that many records just to find the latest record for each ID.  My feature layer is created based on a feature collection object, so I'm unable to query the data based on the time field.  - Carisa