Modification of axis labels prior to showing.

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Gerard
Newbie
Newbie
Posts: 26
Joined: Fri Nov 15, 2002 12:00 am
Location: Australia
Contact:

Modification of axis labels prior to showing.

Post by Gerard » Sat Nov 29, 2003 3:22 am

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

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Dec 01, 2003 3:50 pm

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.

Gerard
Newbie
Newbie
Posts: 26
Joined: Fri Nov 15, 2002 12:00 am
Location: Australia
Contact:

Previous values problem

Post by Gerard » Mon Dec 01, 2003 10:34 pm

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.

Post Reply