tags:

views:

25

answers:

2

I have a process that refreshes a 1000 line graph while a TrackBar scrolls.

I've done some StopWatching and found that ZGC.Refresh() accounts for 90% of the process run time. The ability to see the graph progress as the TrackBar scrolls is essential to the program. Is there any way to optimize the efficiency of ZGC.Refresh() so my program can run faster?

+1  A: 

You could use something like ANTS Performance Profiler to narrow it down to exactly what part of the Refresh() method could use optimization.

Excluding optimization to the method itself, would it be possible to generate a graph that is larger than you actually need and then display only a portion of that graph, letting the scroll change what portion of the graph is currently displayed?

Chris Shaffer
Chris,Regarding your second comment: the way I understand ZedGraph (which could be incorrect) the Refresh() method is required to update the graph. If the slider only changed the viewing window, you still wouldn't see the lines drawn until after Refresh() is called.
Soo
A: 

Instead of Refresh() use Invalidate() - it should be much quicker because it will refresh only those elements that changed.

Sometimes it is needed to use combination AxisCHange() + Invalidate()

Gacek