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 - Wrong right margin when the left axis has minimum=maximum, with decimals
Summary: Wrong right margin when the left axis has minimum=maximum, with decimals
Status: RESOLVED FIXED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Axis (show other bugs)
Version: 37.230130
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: yeray alonso
URL: https://www.steema.com/support/viewto...
Keywords:
: 2577 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-02-15 11:10 EST by yeray alonso
Modified: 2023-03-15 06:31 EDT (History)
2 users (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***