Chart not updating on VCL form after modify the DataSource dynamically
Posted: Tue Apr 25, 2023 5:22 pm
Hi,
I would like to ask for help from people who use TeeChart (pro version, but I think have not different in standard verion)...
I use the following code to modify the Series values for the Chart (linked to database table field), but after running this code the Chart does not update on VCL form...
(Delphi 11.3 + Teechart Pro 2022.34 on windows 11 x64)
What am I missing or doing incorrectly?
Thank you!
I would like to ask for help from people who use TeeChart (pro version, but I think have not different in standard verion)...
I use the following code to modify the Series values for the Chart (linked to database table field), but after running this code the Chart does not update on VCL form...
(Delphi 11.3 + Teechart Pro 2022.34 on windows 11 x64)
What am I missing or doing incorrectly?
Code: Select all
DataSource := DM.DataSourceTest;
DataSet := DataSource.DataSet;
FieldName := Series1.YValues.ValueSource;
DataSet.First;
while not DataSet.Eof do begin
FieldValue := DataSet.FieldByName(FieldName).AsInteger;
if FieldValue > 100 then begin
FieldValue := FieldValue - random(10);
DataSet.Edit;
DataSet.FieldByName(FieldName).AsInteger := FieldValue;
DataSet.Post;
end;
DataSet.Next;
end;
Series1.CheckDatasource;
dbChartTest.Invalidate;
dbChartTest.Refresh;
Application.ProcessMessages;