TAChart: Hide legend if exception happened while attempting to fill it

git-svn-id: trunk@39599 -
This commit is contained in:
ask 2012-12-20 16:35:42 +00:00
parent d85ae3b08e
commit 607dd7c75f
2 changed files with 8 additions and 2 deletions

View File

@ -58,7 +58,6 @@ type
procedure SetAxisIndexX(AValue: TChartAxisIndex);
procedure SetAxisIndexY(AValue: TChartAxisIndex);
procedure SetLegend(AValue: TChartSeriesLegend);
procedure SetShowInLegend(AValue: Boolean);
protected
procedure AfterAdd; override;
@ -67,6 +66,7 @@ type
function GetShowInLegend: Boolean; override;
procedure SetActive(AValue: Boolean); override;
procedure SetDepth(AValue: TChartDistance); override;
procedure SetShowInLegend(AValue: Boolean); override;
procedure SetTitle(AValue: String); virtual;
procedure SetTransparency(AValue: TChartTransparency); override;
procedure SetZPosition(AValue: TChartDistance); override;

View File

@ -58,6 +58,7 @@ type
function GetShowInLegend: Boolean; virtual; abstract;
procedure SetActive(AValue: Boolean); virtual; abstract;
procedure SetDepth(AValue: TChartDistance); virtual; abstract;
procedure SetShowInLegend(AValue: Boolean); virtual; abstract;
procedure SetTransparency(AValue: TChartTransparency); virtual; abstract;
procedure SetZPosition(AValue: TChartDistance); virtual; abstract;
procedure UpdateMargins(ADrawer: IChartDrawer; var AMargins: TRect); virtual;
@ -1006,7 +1007,12 @@ begin
try
for s in Series do
if AIncludeHidden or (s.Active and s.GetShowInLegend) then
s.GetLegendItemsBasic(Result);
try
s.GetLegendItemsBasic(Result);
except
s.SetShowInLegend(AIncludeHidden);
raise;
end;
except
FreeAndNil(Result);
raise;