Dynamic numeric format in axis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
uga
Newbie
Newbie
Posts: 1
Joined: Wed Mar 31, 2004 5:00 am
Location: Universidad de La Laguna
Contact:

Dynamic numeric format in axis

Post by uga » Wed Apr 28, 2004 10:50 am

I want to change the formatting of the values shown in an axis so i can adjust the units dinamically, i. e. for a value of "0.001 V" i want to show "1 mV". Is it there an event that i can use that passes me the value to show in an axis and i return a string representing this number?

Also i have a scrolling real time chart with fixed horizontal axis limits. The series starts with XValues = 0, and i want to hide all axis values, marks and grid lines with negative XValues from the chart. Is this possible?

I am currently using the TChartAxis.OnDrawLabel event, but this event doesn't pass the value before conversion to string and i also have the problem of hiding the marks and the grid.

Thaks for your help.

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

Post by Marjan » Wed Apr 28, 2004 2:57 pm

Hi.

One way to fully customize axis labels is to use Chart OnGetAxisLabel and OnGetNextAxisLabel events. This way you can change existing axis label (usually double value) to any format you require. I think TeeChart help files has an example of this.
Another solution might be to use the same code we used in the axis label tool example. In the example a special tool which displays custom labels for 1e+3, 1e+6 and 1e+9 is coded and used. The example can be found in TeeChart demo. Especially, check the "All Features -> Tools -> Axis Labels" example.
Marjan Slatinek,
http://www.steema.com

Post Reply