Jump to content
jauchriw

TChart in Delphi 10.0 vs Delphi 12.2

Recommended Posts

Hello,

 

I've upgraded a Delphi 10.0 application, which displays a TChart, to Delphi 12.2.

 

I did not have to change any code, the upgrade worked seamlessly except the chart. Strangely, the chart is missing the dotted line on one data line and also the label is missing.

 

Delphi 10 (works as expected):

image.thumb.png.0058e4c307c5f61462287c4a26303ebf.png

 

Delphi 12.2:

image.thumb.png.99f99bc10a95f20fa64e4b96543942d7.png

 

I've already played around with the options of the chart but I didn't manage to fix the issue.

 

The bars are added with multiple calls to

Series3.AddGanttColor(startDate, endDate, row, lbl, color);

 

Does someone have an idea what I could try? I also tried Delphi 11.3 first, but there the chart looks like the one in Delphi 12.2.

Edited by jauchriw

Share this post


Link to post
    {$IF CompilerVersion > 34}
      // The default font changed from "Tahoma, 8 pt" to "Segoe UI, 9 pt"
      // starting with Delphi 11. This increased the text size by 2 pixels.      
      Application.DefaultFont.Name := 'Tahoma';
      Application.DefaultFont.Size := 8;
    {$ENDIF}

Try this fix (insert code into your .dpr file).

Share this post


Link to post

That does not seem to make any difference 😕 I also tried to change the font size of the axis (LeftAxis.LabelsFormat.Font.Height = -7) but the label is still missing

Share this post


Link to post

Was the chart dropped on the form at design time, or was it created at run time?  If it was the former, I would be curious as to whether the issue exists if it gets created by code.  I am guessing not, but don't know.

 

I have had problems with TCharts that were placed at design time when moving from one version of Rad Studio to another because they use the old TChart files/headers and it screws things up.  

Edited by Gord P

Share this post


Link to post

It may be a pixel rounding issue, some variation between versions, thus hiding the Label as it isn't deemed to have enough space. 

 

Test of concept would be to run:

Chart1.Axes.Left.LabelsSeparation := 0;

 

 

Share this post


Link to post
On 10/25/2024 at 5:15 PM, Marc Meumann said:

It may be a pixel rounding issue, some variation between versions, thus hiding the Label as it isn't deemed to have enough space. 

 

Test of concept would be to run:

Chart1.Axes.Left.LabelsSeparation := 0;

 

 

That also makes no difference 😕

Share this post


Link to post

I've managed to reproduce the issue in a small demo application (I tried it with Delphi 12.2, but I assume the problem will also show in Delphi 11).

 

As soon as the third "GanttColor" is added, the label "TEST B" disappears:

image.thumb.png.b199ac1ac51accc169d7ff842841cdfa.png

 

With "Break labels" checkbox checked (just adds a third "GanttColor" to the series):

image.thumb.png.907066f7614d5411d1c70f21dbd66cb3.png

 

In Delpi 10 both modes work as expected.

 

I've attached the dfm and the pas file the the post 😊 Maybe someone has an idea, what is going on here

 

Edited by jauchriw

Share this post


Link to post

The example code is useful. It looks, at first glance, like a a bug ...to be investigated.

 

Temporary workaround could be to directly control the Axis Items list after adding the data:

 

    Chart2.Axes.Left.Items.Clear;
    Chart2.Axes.Left.Items.Add(9,seriesC);
    Chart2.Axes.Left.Items.Add(5,seriesA);
    Chart2.Axes.Left.Items.Add(8,seriesB);

 

  • Like 2

Share this post


Link to post
3 hours ago, Marc Meumann said:

    Chart2.Axes.Left.Items.Clear;
    Chart2.Axes.Left.Items.Add(9,seriesC);
    Chart2.Axes.Left.Items.Add(5,seriesA);
    Chart2.Axes.Left.Items.Add(8,seriesB);

 

Thank you, with this workaround the issue is gone!

 

I assume that a version of TeeChart, where this issue is fixed, will be included in RAD studio 13 at earliest?

Share this post


Link to post

" included in RAD studio 13 at earliest?"

 

Hopefully we'll get there long before that, it shouldn't be too complicated to resolve.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×