I created a custom axis, with Horizontal = true, OtherSide=true, Position=0 so it sits on top of my chart and the text higher. When I select the series horizontal axis to be the top axis, the chart gets smaller so the title area is not obstructed. When I select my custom axis, the chart get larger and the axis labels 'overwrite' the title area. My custom axis inherits from the TChartAxis, and introduces a new LabelValue function. I did not find a RegisterAxis procedure; could that be the problem?
--Paul
Title ignored when using a custom axis (bug?)
small example of problem
Below a small example that shows the problem
--Paul
--Paul
Code: Select all
procedure TForm1.FormShow(Sender: TObject);
var
mySeries: TBarSeries;
HorizAxis : TChartAxis;
begin
mySeries := TBarSeries.Create(Chart1);
mySeries.FillSampleValues(6);
Chart1.AddSeries(mySeries);
HorizAxis := TChartAxis.Create(Chart1);
mySeries.CustomHorizAxis := HorizAxis;
with HorizAxis
do begin
Horizontal := true;
OtherSide := true;
LabelsFont.Size := 14;
end;
end;
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Paul,
This is default custom axes behaviour. To avoid that you can add something like the code in the Workaround section in the snippet below.
This is default custom axes behaviour. To avoid that you can add something like the code in the Workaround section in the snippet below.
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
mySeries: TBarSeries;
HorizAxis : TChartAxis;
begin
mySeries := TBarSeries.Create(Chart1);
mySeries.FillSampleValues(6);
Chart1.AddSeries(mySeries);
HorizAxis := TChartAxis.Create(Chart1);
mySeries.CustomHorizAxis := HorizAxis;
with HorizAxis do
begin
Horizontal := true;
OtherSide := true;
LabelsFont.Size := 14;
end;
//Workaround
Chart1.MarginUnits:=muPercent;
Chart1.MarginTop:=10;
With Chart1.Title do
begin
CustomPosition:=true;
Top:=10;
Left:=Chart1.Width div 2;
end;
//End Workaround
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |