![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Sub chart datasources are not memorized | ||
|---|---|---|---|
| Product: | VCL TeeChart | Reporter: | h.hasenack <hans> |
| Component: | Other Components | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | CONFIRMED --- | ||
| Severity: | major | CC: | sandra |
| Priority: | High | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | RAD XE5, RAD XE6, RAD XE7 |
|
Description
h.hasenack
2014-11-05 10:27:31 EST
I have created a 2 step fix.
1) in my code where the frame with the chart/subchart is dynalically saved/loaded, I had to surround the ReadComponent call with GlobalLoading routines:
BeginGlobalLoading;
try
MyFrame:=aStream.ReadComponent;
NotofyGlobalLoading; // calls Loaded for all loaded components, including subcharts
finally
EndGlobalLoading;
end;
2a) Secondly, I had to patch the TChartSeries.Loaded routine to not only look in the direct owner, but a bit further in the hierarchy as well:
Procedure TChartSeries.Loaded;
{$ifdef HH_PATCH_TC_GETDATASOURCE}
function lclResolveDatasourceByName(const aName:string):TCOmponent;
VAR O:TComponent;
begin
Result:=nil;
O:=Owner;
// try to find as component owned by one of the parent components
while Assigned(O) and not Assigned(Result) do
begin
Result:=O.FindComponent(aName);
O:=O.GetParentComponent;
end;
O:=Owner;
// try to find as component owned by one of the owner components
while Assigned(O) and not Assigned(Result) do
begin
Result:=O.FindComponent(aName);
O:=O.Owner;
end;
end;
{$endif}
var t : Integer;
begin
inherited;
{ when the DataSource has multiple Series, load them... }
if Assigned(FTempDataSources) then
begin
if FTempDataSources.Count>0 then
begin
DataSources.Clear;
for t:=0 to FTempDataSources.Count-1 do
{$ifdef HH_PATCH_TC_GETDATASOURCE}
InternalAddDataSource( lclResolveDatasourceByName(FTempDataSources[t]) );
{$else}
InternalAddDataSource( Owner.FindComponent(FTempDataSources[t]) );
{$endif}
end;
FTempDataSources.Free;
end;
{ finally, gather points from datasource after loading }
CheckDatasource;
end;
2b) And I patched the TChartSeries.IsDataSOurceStored to always return False so it will always use the Dataseources property to store datasource links, while still maintaining backwards compatability for existing forms.
|