Page 1 of 1

Modification of axis labels prior to showing.

Posted: Sat Nov 29, 2003 3:22 am
by 8573707
I am using a TDateTime formatted bottom axis however I want to modify the format of the date/time display based on what was shown previously.

For example, if the previous bottom axis label was "1:00am 1 Mar", I want the next axis label to be "2:00am" and exclude the "1 Mar" because it is obviously we are still in the 1st of March. The same applies for years.

This effectively provides a change of date/time formatting when necessary and neatens up the whole bottom axis.

I have tried a whole range of things and 'OnGetAxisLabel' seemed to be the most applicable way of modifying the axis label text before drawing. However, I needed knowledge of the previous axis label text in order to make a decision and the 'OnGetAxisLabel' event iterates backwards through the axis labels which destroys the logic.

Can anyone make a suggestion as to how to do what I want in a proper manner. The TeeChart tool does'nt seem to provide as many hooks into the drawing process as I might like.

Regards, David Peacock.

david.peacock@mea.com.au

Posted: Mon Dec 01, 2003 3:50 pm
by Marjan
Hi, David.

Why don't you store "previous" axis label outside this routine (private variable, declared in the same unit as chart) and then compare this value with current axis label. This way you will be able to compare current axis label with previously drawn axis label.

Previous values problem

Posted: Mon Dec 01, 2003 10:34 pm
by 8573707
Marjan wrote:Hi, David.

Why don't you store "previous" axis label outside this routine (private variable, declared in the same unit as chart) and then compare this value with current axis label. This way you will be able to compare current axis label with previously drawn axis label.
Marjan,

This is in fact how I began to solve the original problem. However the labels are drawn last to first (right to left). Whether this behaviour is due to an axis property I have set or just the way it is; I don't know. It does prevent me from knowing what the label directly to the left of the one being drawn is.

I have solved this by dynamically controlling the TChartAxis->Increment value so that I can predict the value directly to the left of the one being drawn before it is drawn. In this way, I can achieve what I want to do however the solution is

a) likely not to be the most optimal
b) unexpected.

Thanks for your reply.

David.