Page 1 of 1

TChartEditor and a lot of TDatasets

Posted: Wed Oct 18, 2023 1:18 pm
by 16565015
Hello,

In my application I have hundred of Tdataset. Unfortunately in TchartEditor (=TchartEditor .execute) if you click in DataSource = Dataset it's can take a long time to display the list of Tdatasets.
Does it exists a way to restrict this list ? For example I only want the local (in my current unit/form) dataset or I want to give my own list of Tdataset...

Re: TChartEditor and a lot of TDatasets

Posted: Fri Oct 20, 2023 8:12 am
by yeray
Hello,

I've done a simple example which looks instantaneous here with 100 TFDMemTables:

Code: Select all

uses Chart, DBChart, DBEditCh, Series, EditChar, FireDAC.Comp.Client, Data.DB;

var Chart1: TDBChart;
    FDMemTables: array of TFDMemTable;

procedure TForm1.FormCreate(Sender: TObject);
var val: Double;
    i, j: Integer;
begin
  SetLength(FDMemTables, 100);

  for i:=0 to High(FDMemTables) do
  begin
    FDMemTables[i]:=TFDMemTable.Create(Self);
    FDMemTables[i].Name:='MemTable'+IntToStr(i+1);
    FDMemTables[i].FieldDefs.Add('Price', ftInteger);
    FDMemTables[i].CreateDataSet;
    FDMemTables[i].Open;

    val:=1000+Random(500);
    for j:=1 to 1000 do
    begin
      FDMemTables[i].AppendRecord([val]);
      val:=val+Round(Random(10)-4.5);
    end;
  end;

  Chart1:=TDBChart.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;
  end;

  with Chart1.AddSeries(TLineSeries) do
  begin
    DataSource:=FDMemTables[0];
    YValues.ValueSource:='Price';
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  EditSeries(Self, Chart1[0]);
end;

Re: TChartEditor and a lot of TDatasets

Posted: Fri Oct 20, 2023 4:01 pm
by 16565015
Hello,

I'am sorry but :
My Software is 8 millions of line code (with third party components), 600 forms and more than 40 datamodules where each can contain more than 50 Datasets. All connected to a Firebird database which contains 704 tables where some can containing 150 fields. I don't speak of heavy/complex queries.

When I edit a TdbChart it's can take near to 1 minute on a AMD EPYC 7302 16 core processor !

What about something like an argument which contains an array of Datasets useable ?

Re: TChartEditor and a lot of TDatasets

Posted: Fri Oct 20, 2023 5:02 pm
by yeray
Hello,

I was trying to have a simple project to test the possibilities and the possible new property/method.
But indeed I don't need to reproduce the delay to understand they can be huge.

However, I still don't understand if you'd want the option to restrict the datasets at design-time or at runtime.
At design-time, (please correct my if I'm missing anything) the standard components don't offer such an option. Do you experience a similar delay when you open the DataSet list in a TDataSource?
At runtime, we can study if we can add some option. But please note that we discourage giving users access to the Chart Editor. The Chart Editor is designed to assist developers in creating their charts and is not intended or recommended for end-users.