When to call tchart.Refresh()

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

When to call tchart.Refresh()

Post by BenW » Wed Nov 19, 2008 2:50 am

Hi Narcís.

You have the most knowledge of the type of application I've built, and I'm hoping you can provide some guidance on the issue I'm facing.

Essentially with all the customizations we've built, multiple custom axes, custom Legend positioning, custom and dynamic panel margin sizing based on best fit requirements and label font sizes, etc, etc, sometimes we can get into a situation where some of the chart components don't line up, and won't line up until the next event (that calls .Refresh()) occurs.

For example if we have 2 custom x-axis then sometimes the y and x axes won't line up at their origin, say until the data for the series associated with the second custom x-axis arrives. This leaves the chart looking a little disjoint until it cleans/realigns itself when the next .Refresh() based event occurs.

Is there a mechanism or best practice that you can suggest, where .Refresh() can be called (without causing infinit recursion), so that the various chart bits are always gauranteed to be lined up?

I don't want to introduce something like an internal timer that calls .Refresh() every second or so, because this is wasteful and may cause CPU issues when many of our chart objects are concurrently active.

thanks,
Ben.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Nov 19, 2008 9:01 am

Hi Ben,

I'd try using it just after or before (depending on what's necessary) the code that does such customizations. However be very careful not using it in the AfterDraw and similar events to fall into an endless loop.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply