Page 1 of 1

v2023.39 (231109) y-axis label issue

Posted: Wed Mar 20, 2024 11:03 pm
by 9236183
Hi,
I've just upgraded from 2021.32.210430 to v2023.39 (231109) which seems to have a y-axis drawing difference.
As the image shows attached the left graph has for example 60.48 on the y-axis while on the previous version this would be 64, 56, 48 etc. Axis min = 0 and max = 65. It draws correctly with more space but if window is small its adding the dp's.
The AxisValueFormat is still the default graph_->LeftAxis->AxisValuesFormat = "###0.###";
I can reduce set ###0 which restricts it but wondering why the values produced are so different ?
Is this an issue with the new VCL TChart ?

Re: v2023.39 (231109) y-axis label issue

Posted: Fri Mar 22, 2024 3:40 pm
by yeray
Hello,

I've tried to reproduce the problem with this simple example code without success.

Code: Select all

uses Chart, Series;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1:=TChart.Create(Self);

  with Chart1 do
  begin
    Parent:=Self;
    Align:=alClient;
    Color:=clWhite;
    Gradient.Visible:=False;
    Walls.Back.Color:=clWhite;
    Walls.Back.Gradient.Visible:=False;
    Legend.Hide;
    View3D:=False;

    with AddSeries(TLineSeries) do
      for i:=0 to 19 do
        Add(Random*65);

    Axes.Left.SetMinMax(0, 65);
    Axes.Left.Title.Text:='Left axis';
  end;
end;
Do you have a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.

Re: v2023.39 (231109) y-axis label issue

Posted: Fri Mar 22, 2024 9:28 pm
by 9236183
Thanks Yeray.
I'll have to dig into the code some more to see what is causing the difference and get back to you.
I was assuming exactly the same code base on our side but will dig some more.

Re: v2023.39 (231109) y-axis label issue

Posted: Tue Mar 26, 2024 9:09 pm
by 9236183
Only just had a chance to re-look at what the code we have is doing.
We also have the Axis.Left.Increment := 1 set in this case to try and reduce the number of y-axis labels rather than automatic.
With that setting in the past it still kept the y-axis labels clean rather than having the in the example 64.8, 57.6 etc
I've not tested that code on the older release yet but will try shortly

Re: v2023.39 (231109) y-axis label issue

Posted: Tue Mar 26, 2024 11:03 pm
by 9236183
Ok I've tested with the two TChart version listed previously and as you can see with the same code the graphs look quite different.
Top one is v2021.x and bottom v2023.x

Re: v2023.39 (231109) y-axis label issue

Posted: Wed Mar 27, 2024 3:29 am
by 9236183
Ok I have a work around for the present time.
I check the ClientHeight and when its less than 200pixel I set Increment=0 (which is automatic by my testing) for graphs with max - min height < 200 units.
Greater than 200 height units I just set Increment=0

Re: v2023.39 (231109) y-axis label issue

Posted: Wed Mar 27, 2024 9:55 am
by yeray
Hello,

Indeed setting Increment to 1 was the key to reproduce the problem.
I've added it to the public tracker: #2690