Axis label justification

Ideas and wishes for TeeChart
Post Reply
SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Axis label justification

Post by SteveP » Wed Nov 19, 2003 2:31 pm

Justification of axis labels (left, right, center) with respect to its tic mark. With charts that are not very wide, the min and max axis labels extend beyond the chart's bounds. If the horizontal axis minimum label could be left justified and the maximum label be right justified, then they would lie within the chart bounds.

David Berneda
Site Admin
Site Admin
Posts: 83
Joined: Wed Nov 12, 2003 5:00 am
Location: Girona, Catalonia
Contact:

Post by David Berneda » Wed Nov 19, 2003 4:46 pm

Thanks for your suggestion.
In version 7 (currently in beta), there's a new axis event that is called just before each axis label is going to be displayed.

You can use this event to perform specific custom text alignment per each label.
The code below does the wish you want:

// Set-up the event:

Chart1.Axes.Bottom.OnDrawLabel:=BottomAxisDrawLabel;

// Event:

procedure TForm1.BottomAxisDrawLabel(Sender:TChartAxis; var X,Y:Integer; var Text:String);
begin
if X=Sender.CalcPosValue(Sender.Minimum) then
Chart1.Canvas.TextAlign:=TA_LEFT
else
if X=Sender.CalcPosValue(Sender.Maximum) then
Chart1.Canvas.TextAlign:=TA_RIGHT;
end;

If you wish to beta-test v7, please follow the link below.
(sorry if you already are a beta-tester)

http://www.steema.com/support/teechart/ ... sting.html

regards
david

SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Post by SteveP » Thu Nov 20, 2003 5:01 pm

David,

What's the best way (and where to do it) to force axis lables to only be displayed at axis minimum and maximum ? I tried assigning Chart1.Axes.Bottom.Increment := Chart1.Axes.Bottom.Maximum-Chart1.Axes.Bottom.Minimum.

Thanks,

Steve

Post Reply