Page 1 of 1

Dynamic numeric format in axis

Posted: Wed Apr 28, 2004 10:50 am
by 9336953
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.

Posted: Wed Apr 28, 2004 2:57 pm
by Marjan
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.