reporting two tdbchart bugs

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
rbarone
Newbie
Newbie
Posts: 15
Joined: Thu May 18, 2023 12:00 am

reporting two tdbchart bugs

Post by rbarone » Fri Apr 12, 2024 10:04 am

Hi
Sorry for my english (google traslate)
I would like to point out two bugs encountered when using tdbchart
1) If I create multiple series in the groups and delete one from that moment the series counter displays the references incorrectly
(serial number error.png)
2) A persistent field of a tclientdataset set to currency is reported correctly if used in the label if used as the value of X the format is lost
(currency error.png)

Delphi 12
Windows 10
TeeChartVCLFMXStandard-2023.39
Attachments
currency error.png
problem 2
currency error.png (216.27 KiB) Viewed 308 times
series number error.png
problem 1
series number error.png (244.82 KiB) Viewed 308 times

Yeray
Site Admin
Site Admin
Posts: 9538
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: reporting two tdbchart bugs

Post by Yeray » Mon Apr 15, 2024 9:40 am

Hello,
rbarone wrote:
Fri Apr 12, 2024 10:04 am
1) If I create multiple series in the groups and delete one from that moment the series counter displays the references incorrectly
(serial number error.png)
When you create a series, no Name is set to it by default. And when a series doesn't have a Name set, both the legend and the TChartListBox (used to draw the series list in the Editor) use the SeriesNameOrIndex function to calculate a string to draw each item. Then, the issues here are:
- The SeriesNameOrIndex method gives Series1 always for the first series. If you remove the first series, then the next series will be Series1.
- The TChartListBox doesn't refresh when you remove a series. That's why the Editor and the Legend look out of sync. If you close the Editor and reopen it, they should be in sync again.

Maybe we should save an internal Name when a Series is created, in a similar way as we do with the Series Color, where we use a internal ISeriesColor property. I've added it to the public tracker (#2694).

In the meanwhile, you could make sure you set a Name property in your series. Ie using the GetNewSeriesName function:

Code: Select all

    for i:=0 to nSeries-1 do
      with AddSeries(TBarSeries) do
      begin
        Marks.Hide;
        Name:=GetNewSeriesName(Self);
        FillSampleValues;
      end;
rbarone wrote:
Fri Apr 12, 2024 10:04 am
2) A persistent field of a tclientdataset set to currency is reported correctly if used in the label if used as the value of X the format is lost
(currency error.png)
I'll take a look at this asap.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9538
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: reporting two tdbchart bugs

Post by Yeray » Mon Apr 15, 2024 11:42 am

Hello,

I'm trying to reproduce the problem in a simple example project without success.
This is the closest I can get to your screenshot with a simple example:
LegendDataSet.png
LegendDataSet.png (29.54 KiB) Viewed 280 times

Code: Select all

uses Chart, DBChart, Series, Engine, FireDAC.Comp.Client;

var Chart1: TDBChart;
var MemTable1: TFDMemTable;

procedure TForm1.FormCreate(Sender: TObject);
var val: double;
    i: Integer;
begin
  MemTable1:=TFDMemTable.Create(Self);
  with MemTable1 do
  begin
    Name:='MemTable1';

    FieldDefs.Add('Price', ftCurrency);
    with FieldDefs.AddFieldDef do
    begin
      Name:='Name';
      DataType:=ftString;
      DisplayName:='Name';
    end;

    CreateDataSet;
    Open;

    val:=1000+Random(500);
    for i:=1 to 5 do
    begin
      AppendRecord([val, 'val'+IntToStr(i)]);
      val:=val+Round(Random(10)-4.5);
    end;
  end;

  Chart1:=TDBChart.Create(Self);

  with Chart1 do
  begin
    Parent:=Self;
    Align:=TAlignLayout.Client;
    Color:=TAlphaColors.White;
    Gradient.Visible:=False;
    Walls.Back.Color:=TAlphaColors.White;
    Walls.Back.Gradient.Visible:=False;
    View3D:=False;

    Legend.TextStyle:=ltsRightPercent;

    with AddSeries(TPieSeries) do
    begin
      Marks.Style:=smsValue;
      DataSource:=MemTable1;
      YValues.ValueSource:='Price';
      XLabelsSource:='Name';
    end;
  end;
end;
Could you modify the example above, or arrange a simple example we can run as-is, so we can reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

rbarone
Newbie
Newbie
Posts: 15
Joined: Thu May 18, 2023 12:00 am

Re: reporting two tdbchart bugs

Post by rbarone » Mon Apr 15, 2024 1:50 pm

HI
First of all, I'll tell you that I didn't write code but I directly used the tbchart/dataset configuration
I will make sure to give you as many details as possible by writing you step by step what to do
I hope to find some time between today and tomorrow, sorry if I can't immediately
sorry for my English

rbarone
Newbie
Newbie
Posts: 15
Joined: Thu May 18, 2023 12:00 am

Re: reporting two tdbchart bugs

Post by rbarone » Mon Apr 22, 2024 1:14 pm

HI
I tried to reproduce the error as best as possible, I will send you the structure and data of the table in csv format
and 2 screenshots explaining how to reproduce the problem.
I didn't write code but just used DBCHART objects and a clientdataset
I remain available to help you
Raffaele

Delphi 12.1
TeeChartVCLFMXStandard-2024.40

Code: Select all

/********* TABLE INTERBASE 2020 UPDATE 5*******/
CREATE TABLE TR_MGRUPPO 
(
        PK_PROGRESSIVO	INTEGER DEFAULT 0 NOT NULL,
        FK_MG	INTEGER DEFAULT 0 NOT NULL,
        TOT_ORE	DOUBLE PRECISION DEFAULT 0 NOT NULL,
        TOT_COSTO	DOUBLE PRECISION DEFAULT 0 NOT NULL,
        TOT_ORE_ISTITUZIONALI	DOUBLE PRECISION DEFAULT 0 NOT NULL,
 PRIMARY KEY (PK_PROGRESSIVO)
);


/***** DATA FOR TABLE *****/
PK_PROGRESSIVO;FK_MG;TOT_ORE;TOT_COSTO;TOT_ORE_ISTITUZIONALI
251;1;7540;240008,73;103445,4
252;2;642;29766;2111,22
253;3;0;0;0
254;4;536;40200;2306,26
255;5;1937;145275;12641,48
256;6;91;3353;4565,23
257;7;963;66112,12;3308,36
258;8;314;23550;1552,57
259;9;1321,3;49284,49;14719,08
260;10;1390;52870,9;4062,34
Attachments
currency error.png
DELPHI 12.1 form FMX
currency error.png (133.77 KiB) Viewed 136 times
currency work fine.png
DELPHI 12.1 form FMX
currency work fine.png (125.17 KiB) Viewed 136 times

rbarone
Newbie
Newbie
Posts: 15
Joined: Thu May 18, 2023 12:00 am

Re: reporting two tdbchart bugs

Post by rbarone » Sat Apr 27, 2024 2:24 pm

to supplement my report ": reporting two tdbchart bugs" (no response from you about this)
I attach a screenshot of a persistent and annoying label overlap when using the comboboxes for setting a dataset

Ciao
Raffaele Barone
Attachments
overlap.png
overlap label
overlap.png (153.65 KiB) Viewed 52 times

Yeray
Site Admin
Site Admin
Posts: 9538
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: reporting two tdbchart bugs

Post by Yeray » Mon Apr 29, 2024 1:26 pm

Hello Raffaele,

I've done a simple example in code using your dataset:

Code: Select all

uses Editor.Chart, Editor.DBChart, Chart, DBChart, Series, Engine, FireDAC.Comp.Client, Data.DB;

var PieChart, BarChart: TDBChart;
var MemTable1: TFDMemTable;

procedure TForm1.EditPieButtonClick(Sender: TObject);
begin
  TChartEditForm.Edit(Self, PieChart);
end;

procedure TForm1.EditBarButtonClick(Sender: TObject);
begin
  TChartEditForm.Edit(Self, BarChart);
end;

procedure TForm1.FormCreate(Sender: TObject);
var val: double;
    i: Integer;
begin
  MemTable1:=TFDMemTable.Create(Self);
  with MemTable1 do
  begin
    Name:='TR_MGRUPPO';

    FieldDefs.Add('PK_PROGRESSIVO', ftInteger);
    FieldDefs.Add('FK_MG', ftInteger);
    FieldDefs.Add('TOT_ORE', ftFloat);
    FieldDefs.Add('TOT_COSTO', ftCurrency);
    FieldDefs.Add('TOT_ORE_ISTITUZIONALI', ftCurrency);

    CreateDataSet;
    Open;

    AppendRecord([251, 1, 7540, 240008.73, 103445.4]);
    AppendRecord([252, 2, 642, 29766, 2111.22]);
    AppendRecord([253, 3, 0, 0, 0]);
    AppendRecord([254, 4, 536, 40200, 2306.26]);
    AppendRecord([255, 5, 1937, 145275, 12641.48]);
    AppendRecord([256, 6, 91, 3353, 4565.23]);
    AppendRecord([257, 7, 963, 66112.12, 3308.36]);
    AppendRecord([258, 8, 314, 23550, 1552.57]);
    AppendRecord([259, 9, 1321.3, 49284.49, 14719.08]);
    AppendRecord([260, 10, 1390, 52870.9, 4062.34]);
  end;

  PieChart:=TDBChart.Create(Self);
  BarChart:=TDBChart.Create(Self);

  with PieChart do
  begin
    Parent:=Self;
    Align:=TAlignLayout.Client;
    Color:=TAlphaColors.White;
    Gradient.Visible:=False;
    Walls.Back.Color:=TAlphaColors.White;
    Walls.Back.Gradient.Visible:=False;

    Legend.TextStyle:=ltsRightPercent;
    Legend.FontSeriesColor:=True;

    with AddSeries(TPieSeries) do
    begin
      Marks.Hide;
      DataSource:=MemTable1;
      YValues.ValueSource:='TOT_COSTO';
      XLabelsSource:='TOT_COSTO';
    end;
  end;

  with BarChart do
  begin
    Parent:=Self;
    Align:=TAlignLayout.Right;
    Color:=TAlphaColors.White;
    Gradient.Visible:=False;
    Walls.Back.Color:=TAlphaColors.White;
    Walls.Back.Gradient.Visible:=False;
    Width:=Form1.Width div 2;

    Legend.TextStyle:=ltsRightPercent;
    Legend.FontSeriesColor:=True;

    with AddSeries(TBarSeries) do
    begin
      Marks.Hide;
      DataSource:=MemTable1;
      YValues.ValueSource:='TOT_COSTO';
      XLabelsSource:='TOT_COSTO';
      ColorEachPoint:=True;
    end;
  end;
end;
And this is how it looks for me here:
mstsc_tI0jrwMgTp.png
mstsc_tI0jrwMgTp.png (49.9 KiB) Viewed 33 times
Could you please give it a try?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply