fpspreadsheet: Avoid creating TsChartLink in fpschart demo again and again.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9428 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-09-06 17:45:27 +00:00
parent fc509d130b
commit 18f3689db7
3 changed files with 14 additions and 4 deletions

View File

@ -147,6 +147,8 @@ begin
for i := 1 to sWorksheetGrid1.Worksheet.GetLastRowIndex+1 do
sWorksheetGrid1.AutoRowHeight(1);
FreeAndNil(sChartLink);
sChartLink := TsWorkbookChartLink.Create(self);
sChartLink.Chart := Chart1;
sChartLink.WorkbookSource := sWorkbookSource1;

View File

@ -1,2 +1,5 @@
The fpschart demo shows usage of the TsWorkbookChartSource component for
The fpschartlink projects demonstrates how to use TsChartLink component to display
charts embedded in a worksheet by means of the TAChart library.
The workbookchartsource demo shows usage of the TsWorkbookChartSource component for
creating charts from spreadsheet data.

View File

@ -1168,6 +1168,11 @@ begin
FBrushBitmaps.Free;
FChartStyles.Free;
FLogLabelSource.Free;
if Assigned(FChart) then
begin
FChart.OnAfterDraw := FSavedAfterDraw;
FChart := nil;
end;
inherited;
end;
@ -1421,10 +1426,10 @@ begin
if FSavedAfterDraw <> nil then
FSavedAfterDraw(ASender, ADrawer);
{ TCanvasDrawer.SetBrushParams does not remove the Brush.Bitmap when then
{ TCanvasDrawer.SetBrushParams does not remove the Brush.Bitmap when the
Brush.Style does not change. Since Brush.Style will be reset to bsSolid
in the last statement of TChart.Draw this will be enforced by setting
Brush.Style to bsClear here. }
in the last statement of TChart.Draw this will be enforced here by setting
Brush.Style to bsClear. }
ADrawer.SetBrushParams(bsClear, clTAColor);
end;