Title ignored when using a custom axis (bug?)

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
PvdE
Newbie
Newbie
Posts: 13
Joined: Tue Aug 16, 2005 4:00 am
Location: Washington, DC

Title ignored when using a custom axis (bug?)

Post by PvdE » Wed Aug 24, 2005 1:46 am

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

PvdE
Newbie
Newbie
Posts: 13
Joined: Tue Aug 16, 2005 4:00 am
Location: Washington, DC

small example of problem

Post by PvdE » Fri Aug 26, 2005 2:57 pm

Below a small example that shows the problem
--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;


Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Aug 26, 2005 3:34 pm

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.

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply