Axis label justification
Axis label justification
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.
-
- Site Admin
- Posts: 83
- Joined: Wed Nov 12, 2003 5:00 am
- Location: Girona, Catalonia
- Contact:
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
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