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 2588

Summary: Wrong right margin when the left axis has minimum=maximum, with decimals
Product: VCL TeeChart Reporter: yeray alonso <yeray>
Component: AxisAssignee: yeray alonso <yeray>
Status: RESOLVED FIXED    
Severity: enhancement CC: bj.notifications, yeray
Priority: ---    
Version: 37.230130   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: https://www.steema.com/support/viewtopic.php?f=3&t=17839
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2023-02-15 11:10:42 EST
When all the values in a series have the same y value, the left axis has minimum=maximum. Then, when this value has decimals, it is rounded when calculating the maximum labels width and thus the automatic margin is wrong.

Here the simple example:

type TChartPos = (cTop, cBottom);

procedure TForm1.FormCreate(Sender: TObject);

  procedure CreateChart(AChartPos: TChartPos);
  var Chart: TChart;
      i: Integer;
  begin
    Chart:=TChart.Create(Self);
    Chart.Parent:=Self;
    Chart.View3D:=False;
    Chart.Legend.Hide;
    Chart.Left:=10;

    Chart.Axes.Left.LabelsFont.Size:=12;
    Chart.Axes.Bottom.LabelsFont.Size:=12;
    Chart.Title.Hide;

    Chart.AddSeries(TLineSeries);

    if AChartPos = cTop then
    begin
      Chart.Top:=10;
      for i:=0 to 8 do
        Chart[0].Add(1.088);
    end
    else
    begin
      Chart.Top:=Chart.Height+20;
      for i:=0 to 8 do
        Chart[0].Add(49+random*2);
    end;
  end;

begin
  CreateChart(cTop);     // wrong
  CreateChart(cBottom);  // correct
end;
Comment 1 yeray alonso 2023-03-15 06:31:52 EDT
*** Bug 2577 has been marked as a duplicate of this bug. ***