Page 1 of 1

Performance / Buffering chart repaints

Posted: Thu May 31, 2007 9:47 pm
by 13045435
Is there a method of buffering the chart updates?

We have anything from 50 to 300 traces, each of a few hundred data points. The time taken for the chart to be drawn can be anything from 300ms on a fast machine to 2000ms on a slower machine. This is fine for the first time but the whole chart seems to be always redrawn even for forms being moved over the top of the chart.

I would have thought that the whole chart only needs to be redrawn when the series data is manipulated, the graph zoomed or panned etc. For a simple redraw can it use a cached canvas / image?

I've used all of the optimisation tricks I could find in the forum.

The chart uses fastlines and CoordTrackLines.

Any further tips?

Posted: Fri Jun 01, 2007 8:24 am
by narcis
Hi Loz,

I'd suggest you to have a look at the code example I posted on this thread. Using autorepaint property may help you solving your problems.

Posted: Fri Jun 01, 2007 8:32 am
by 13045435
Thanks for the info. Unfortunately I'm already doing that.

I'm fairly happy with the first time the graph is draw with all of the traces.

The problem comes when the canvas needs to be repainted. It doesn't seem to just use a cached image, it actually redraws the series. I tried dragging windows over the top of the 'feature demo' and I can see the same effect (albeit it's fast with that chart as there are only two traces).

If I reduce the number of visible traces from 300 down to a couple, it's really fast. I'd have thought that if it used a cached copy of the canvas when there's been no change to the zoom / panning / data then it should be just as fast.

Posted: Fri Jun 01, 2007 8:38 am
by narcis
Hi Loz,

Have you tried setting AutoRepaint back to false after series have been refreshed and just set this property to true when you want the series being refreshed? That way the chart should only be repainted when data has been added to the series.

Posted: Fri Jun 01, 2007 9:08 am
by 13045435
Yes, I've tried setting the AutoRepaint to false afterwards too.

This doesn't make any difference to the timing.

1. If I have AutoRepaint enabled and reduce the number of visible traces, it gets faster. 2000ms down to 30ms for 1 visible trace.

2. If I have AutoRepaint disabled and reduce the number of visible traces, it's faster as in (1) but I only see a small area of the screen being redrawn.

It's almost as if the graph is redrawn no matter what the setting and it only affects how the visible canvas is updated.

I ran DevPartner Studio and it confirms the internal Draw commands are being called regardless of AutoRepaint. I think it's this internal re-drawing that's causing the problem. I wouldn't have thought it should be doing that if the AutoRepaint is false or unless data or the view has changed?

We really like version 3 and if we can figure out a way of improving the performance it'd be spot on.

Posted: Fri Jun 01, 2007 10:05 am
by narcis
Hi Loz,

Yes, this is a known problem and is common to all controls (System.Windows.Forms.Control) that's where TeeChart's base class inherits from. Even the control is set to DoubleBuffer every time the form containing a control is opened or some other window is dragged over it, the control is repainted.

We are investigating on implementing a manual DoubleBuffer feature to avoid that behaviour.

Posted: Fri Jun 01, 2007 10:11 am
by 13045435
It's a shame the repaint causes the graph to be recreated.

If there's a way round it or I can help with testing, please let me know.

Many thanks.

Posted: Fri Jun 01, 2007 10:22 am
by narcis
Hi Loz,

Thanks for your offering.

For now, the only solution we are aware of is implementing manual DoubleBuffer.

I'd recommend you to be aware at this forum for new release announcements and its release notes for what's being implemented/fixed on them.

Posted: Tue Jun 19, 2007 5:02 pm
by 9794096
Is there anything else at this point that can be done to suppress the repaint of the TeeChart graph when the window containing it is resized or moved or anything like that?

I also tried setting the AutoRepaint to false but any time I resize my MDI Child window containing the TeeChart control, the redraw gets called while I am resizing.

Our solution was to display a bitmap image of the chart instead of the TeeChart control itself. This way, we control when that image gets refreshed.
This sounded like a good idea until we start to try to add other Steema tools/controls into the use of our chart (like axis arrows, etc). Now we are having a problem because we are not operating directly with the TeeChart control but instead we are operating against a bitmap image that reproduces what the TeeChart control would look like.

Any improvements on this repaint process would be greatly appreciated. I understand your obstacle due to the base class limitations but if there is anything that can help with this sort of thing, it would be very useful.

Thanks.
Aaron

Posted: Wed Jun 20, 2007 7:58 am
by narcis
Hi Aaron,

I'm afraid there's anything else that can be done here for now. As I posted before, we will try implementing manual DoubleBuffer support to solve this problem.