Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1173

Summary: axis title with angle=90 of custom vertical axis -> position horizontal position depends of Title Caption
Product: VCL TeeChart Reporter: Bert Kreisel <bert.kreisel>
Component: AxisAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED FIXED    
Severity: major CC: johannes.barthelmaes, narcis, sandra
Priority: High    
Version: 150120   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version: RAD XE5

Description Bert Kreisel 2015-03-16 03:32:06 EDT
The horizontal position of the axis title with Angle=90 of a custom vertical axis changed with the length of the Title.Caption. Longer titles becomes more space to the axis. Normal length title (10 char) are no longer in the visible range of our charts!
Comment 1 narcís calvet 2015-04-01 09:33:59 EDT
This can be reproduced with the code snippet below.

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
Var MyAxis : TChartAxis ;
begin
  Chart1.AddSeries(TLineSeries.Create(Self)).FillSampleValues;
  Chart1.AddSeries(TLineSeries.Create(Self)).FillSampleValues;

  MyAxis:=TChartAxis.Create(Chart1);
  MyAxis.Title.Caption:='Extra axis';
  MyAxis.Title.Angle:=90;

  Chart1[0].CustomVertAxis:=MyAxis;
end;
Comment 2 narcís calvet 2015-04-01 10:15:48 EDT
At TeEngine.pas, implementing TChartAxis.GetAxisTitle as shown below solves the problem.

function TChartAxis.GetAxisTitle:TChartAxisTitle;
begin
  if not Assigned(FAxisTitle) then
  begin
    FAxisTitle:=TChartAxisTitle.Create(ParentChart);

    if not Self.Horizontal then
      if (Self=ParentChart.FLeftAxis) or not Self.OtherSide then
         FAxisTitle.InitAngle(90)
      else
      if (Self=ParentChart.FRightAxis) or Self.OtherSide then
         FAxisTitle.InitAngle(270);

    FAxisTitle.IDefaultAngle:=FAxisTitle.Angle;
  end;

  result:=FAxisTitle;
end;
Comment 3 Bert Kreisel 2015-04-07 03:22:03 EDT
The problem persists for (Angle=270 and not OtherSide) and
(Angle=90 and OtherSide)
Comment 4 narcís calvet 2015-04-13 06:10:59 EDT
Yes, that's right. Drop a TChart component into a form and use the code snippet below to reproduce it:

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
Var
  MyAxis1, MyAxis2 : TChartAxis;
begin
  Chart1.AddSeries(TLineSeries.Create(Self)).FillSampleValues;
  Chart1.AddSeries(TLineSeries.Create(Self)).FillSampleValues;
  Chart1.AddSeries(TLineSeries.Create(Self)).FillSampleValues;

  MyAxis1:=TChartAxis.Create(Chart1);
  MyAxis1.Title.Caption:='Extra axis';
  MyAxis1.Title.Angle:=270;

  MyAxis2:=TChartAxis.Create(Chart1);
  MyAxis2.Title.Caption:='Extra axis';
  MyAxis2.Title.Angle:=90;
  MyAxis2.OtherSide:=True;

  Chart1[0].CustomVertAxis:=MyAxis1;
  Chart1[1].HorizAxis:=aBothHorizAxis;
  Chart1[1].VertAxis:=aBothVertAxis;
  Chart1[2].CustomVertAxis:=MyAxis2;

  Chart1.Axes.Left.Title.Caption:='left axis title';
  Chart1.Axes.Bottom.Title.Caption:='bottom axis title';
  Chart1.Axes.Right.Title.Caption:='right axis title';
  Chart1.Axes.Top.Title.Caption:='top axis title';
end;
Comment 5 johannes.barthelmaes 2015-04-17 07:19:26 EDT
Hey Narcis,

what about the problem described by Bert?

The problem persists for (Angle=270 and not OtherSide) and
(Angle=90 and OtherSide)

Is this already fixed?
Comment 6 narcís calvet 2015-04-17 07:30:55 EDT
Hi Johannes,

Yes, it is. Please check your email.