I want to connect to a TDataset but my TdbChart it's display a single record !

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Fab
Newbie
Newbie
Posts: 12
Joined: Mon Feb 18, 2013 12:00 am

I want to connect to a TDataset but my TdbChart it's display a single record !

Post by Fab » Wed Oct 18, 2023 12:35 pm

Hello,

I would like to dynamically create a serie to connect to a dataset :
query = select myfield,count(myfield) from XXX group by 1

The code is very simple :

Code: Select all

procedure TForm26.Button1Click(Sender: TObject);
begin
  DBChart1.AddSeries(TPieSeries);

  DBChart1.Series[0].DataSource := Q_TABLEFX;  
  DBChart1.Series[0].YValues.ValueSource := 'SERIE1';
  DBChart1.Series[0].XLabelsSource := 'GROUPE1';
end;
In an empty project it's work fine. It's display my (multiple record) dataset.


But in my 7 millions of line of code program with the same code my TDBChart display a Single record like this :
UniqueRecord.png
UniqueRecord.png (92.81 KiB) Viewed 12037 times
and result :
UniqueRecord_result.png
UniqueRecord_result.png (62.4 KiB) Viewed 12037 times
But I want = If I edit (in runtime) my TDBChart to connect to a dataset it's work :
Dataset_result.png
Dataset_result.png (260.09 KiB) Viewed 12037 times


I have tried uses order without change.

Why my TDBChart display it datasource as "Single record" and not as a (multi-record) dataset ?


In other words of to force a dataset or a single record dataset ?

PS : I use Teechart Pro 2023.38.230607 VCL with Delphi 11.3

Fab
Newbie
Newbie
Posts: 12
Joined: Mon Feb 18, 2013 12:00 am

Re: I want to connect to a TDataset but my TdbChart it's display a single record !

Post by Fab » Wed Oct 18, 2023 1:14 pm

Ok I have understand my mistake.
It's if you connect DBChart1.Series[0].DataSource to a TDatasource component (connected to a Tdataset) !
Strangely in this case it display a "single record" ?!

Post Reply