Page 1 of 1

CalcIncrement

Posted: Mon Jun 07, 2004 4:05 pm
by 9082517
Hi,

I'm just wondering when the CalcIncrement method is supposed to return reliable results. As far as I've seen values aren't good and steady until when _OnAfterDraw fires. In events that fire before this event CalcIncrement returns diffrent values.

Is there any way to get a reliable measurement for the Labels Increment before the chart is completely redrawn?

I'd like to format axis labels differently depending on Increment.

/ Fredrik

Posted: Tue Jun 08, 2004 7:45 am
by Pep
Hi Fredrik,

how about using the Environment.Internal repaint method ? (Se the Help for details).

Posted: Tue Jun 08, 2004 8:07 am
by 9082517
Calling Internalrepaint in the eventhandlers for the chart seems to make it (the chart) crash quite unpredictably.

Even if the chart would not crash, do you have a good method to avoid infinite recursion if you call InternalRepaint from an eventhandler?

Posted: Wed Jun 09, 2004 12:21 pm
by Marc
Hello,

InternalRepaint called from event handlers could cause repaint recursion ...with the results that you've seen, in general best not to call it from events. InternalRepaint causes an internal paint (as the name suggests) and allows you to 'setup' characteristics and in this case possibly to be able to pre-read dimensions for when you come to the screen paint of the Chart.

If that doesn't give you the result you require then there is little other way to calculate Increment as CalcIncrement needs the paint process complete to be able to effectively return the correct result. Other elements such as string lengths (in pixels) could be calculated by knowing Font info of an element and using TeeChart's canvas methods TextWidth, TextHeight, etc. Most other element positions can be obtained via Axis or Series CalcX... and CalcY... methods. See Tutorial 13 for details.

Regards,
Marc Meumann