Page 1 of 1

Axis label justification

Posted: Wed Nov 19, 2003 2:31 pm
by 9333098
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.

Posted: Wed Nov 19, 2003 4:46 pm
by David
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

Posted: Thu Nov 20, 2003 5:01 pm
by 9333098
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