youcef92 / flotr

Automatically exported from code.google.com/p/flotr
0 stars 0 forks source link

"redraw" functionality of a chart with updated data #137

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hopefully I don't sound like an idiot by asking this because of just 
overlooking something.... 

Could we get the possibility to "redraw" a chart without creating an entirely 
new chart (i.e. Flotr.draw())? Specifically I'm working on using Flotr in a 
mobile environment, and when scrolling through the chart (via 
http://phenxdesign.net/projects/flotr/examples/prototype/mouse-drag.html) the 
"move" events are getting fired faster than Flotr.draw() can create the new 
chart.

All I'm looking for is the ability to update the data and redraw. I put some 
timers in there and found that the calls to actually draw the chart took about 
40-60% of the total time of Flotr.draw().

On a side note, this is only noticeable on a mobile device, all looks great on 
a PC.

Original issue reported on code.google.com by mark.inm...@gmail.com on 8 Aug 2010 at 4:08

GoogleCodeExporter commented 8 years ago
If drawing the chart takes about half the time, where is the rest spent?  If 
it's in determining the axes and such, perhaps it's a good idea to fetch the 
options object from the flotr object after it's been modified and use that in 
your new calls to Flotr.draw(). This saves the time it takes to calculate the 
axes and such.

I think it may be more useful to improve performance of Flotr than to provide a 
redraw() function, unless it is clear that the setup really takes too much time.

Original comment by peter....@solide-ict.nl on 9 Aug 2010 at 8:34

GoogleCodeExporter commented 8 years ago
This time spent may be this : 
 - plugins registering
 - options inheritance and data pre-processing
 - events initialization
 - fired events (before draw, after draw, etc)
 - canvas tags initialization or configuration

I'm aware a lot of tis stuff can be don only once, and we could also add an 
"update" method that would update only the data, and nothing else.

Original comment by fabien.menager on 12 Aug 2010 at 12:57

GoogleCodeExporter commented 8 years ago
Since I didn't have a need for the events fired/initialization, I simply 
removed those from mine and it helped out quite a bit.

If you could get an update method in the next milestone that would be great, 
but for the time being I'm also fine with what I have now.If I do end up taking 
the time to create an update method of my own I'd be glad to share it and have 
you see if there's anything I missed or could be done better.

Thanks for the consideration!!

Original comment by mark.inm...@gmail.com on 24 Aug 2010 at 3:49