Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-05-2012, 10:33 AM   #1
mavenUser
Registered User
 
Join Date: Feb 2012
Posts: 2
Default Scrolling large chart data

Hi all,

I'm trying to add some functionnalities to a custom chart (zoom+, zoom-, scrolling). My goal is to have some graph functionnality like this one :

zonebourse.com/SOCIETE-GENERALE-4702/analyse_technique-plein/&plein=1

I've implemented these 3 functionnalities but it's very slow to zoom and scroll (more than 10s) on a dataProvider size > 1500 whereas example graph is very fluid.

Here is zoom- implémentation :

ActionScript Code:
var toCheckIn:uint = Math.min(toolBar.stepChooser.value, _initialDataAsArrayLength - subArrayLength);                                         if(toCheckIn == 0)                         return;                                         // Si l'espace entre l'index Y et la fin du tableau en longueur est suffisant pour ajouter autant de valeur que de toCheckIn, alors on ajoute tout ŕ droite                     // Sinon on ajoute ŕ droite (si on peut) un maximum d'items puis ŕ gauche                                         if((_initialDataAsArrayLength - _indexesDisplayed.y) >= toCheckIn)                     {trace("cas1");                         (chartRef.dataProvider as ListCollectionView).addAll(new ArrayList(_initialDataAsArray.slice(_indexesDisplayed.y+1, toCheckIn)));                         _indexesDisplayed.y += toCheckIn;                     }                     else if((_initialDataAsArrayLength - _indexesDisplayed.y) > 0)                     {trace("cas2");                         var toRight:uint = _initialDataAsArrayLength - _indexesDisplayed.y;                         (chartRef.dataProvider as ListCollectionView).addAll(new ArrayList(_initialDataAsArray.slice(_indexesDisplayed.y+1, toRight)));                         _indexesDisplayed.y += toRight;                                                 var remaining:uint = toCheckIn - toRight;                         (chartRef.dataProvider as ListCollectionView).addAllAt(new ArrayList(_initialDataAsArray.slice(_indexesDisplayed.x - remaining, remaining)), 0);                                                _indexesDisplayed.x -= remaining;                     }                     else                     {trace("cas3");                         (chartRef.dataProvider as ListCollectionView).addAllAt(new ArrayList(_initialDataAsArray.slice(_indexesDisplayed.x - toCheckIn, toCheckIn)), 0);                                                _indexesDisplayed.x -= toCheckIn;                     }

with :

stepChooser -> HSlider to choose number of items added/removed par a zoom (- or +)
_initialDataAsArrayLength -> size of the initial dataProvider
_subArrayLength -> size of the actual dataProvider displayed
chartRef -> reference to the chart
_indexesDisplayed -> Point referencing "coordinates" of the subArray displayed in the inital dataProvider (to keep in memory for scroll or zoom)



Everything works but it's very slow for large data.

How can I improve my algorithm please ?

Ty

PS: sorry for my poor english
mavenUser is offline   Reply With Quote
Old 02-08-2012, 11:56 AM   #2
wvxvw
Holosuit User
 
wvxvw's Avatar
 
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,301
Send a message via ICQ to wvxvw
Default

I saw that graph kind before, I think it's some OSS library, so, probably, instead of trying to add on top of Adobe charts (which are frankly not so performant), maybe just look for alternatives?
Your code looks perfectly fine to me, nothing that would make me suspect the problem is there.

On a more general scale, probably, that doesn't make much sense to display 1500 element of data at once - humans will hardly be ever able to comprehend that much So, naturally, you'd like to prepare the data before it is displayed - either display it in chunks, or approximate it to something more easily comprehended.
__________________
The .NET open source editor for Flash and web developers
*This would be my contribution to the project*
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:26 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.