Charts and Performance
As you might have seen in the demo, i want to display 100+ charts on a map. Until today, i created a chart-object (along with dataProvider, Series, and stuff) for every view to be displayed. This rendered the application unresponsive for some seconds, showed no progress and consumed lots of memory.
While reworking my display and layer-objects, i implemented another idea:
- a single chart is created
- a single row is rendered and its chart-bitmap copied to the display
- the next row is rendered
if you add “+100 charts” to the map, 100 sets of random data are added to an ArrayCollection, the dataProvider for the LayerCharts. LayerCharts intercepts the COLLECTION_CHANGE events, adds the symbols and queues the rows for rendering. When i get a custom RENDER_COMPLETE event, i copy the data to a bitmap for display.
Problems
A chart does not render if not added to something derived from UIComponent. It needs updateDisplayList() to be called. Adding it to a Sprite is not sufficient as it is no “flex” component.
Leave a Reply