TAChart: Adapt TBoxAndWhiskerSeries.YDataLayout to changes in the YIndex* properties.

This commit is contained in:
wp_xyz 2022-02-04 22:08:22 +01:00
parent 28b8533917
commit d5ab80d754

View File

@ -129,6 +129,7 @@ type
procedure SetYIndexCenter(AValue: Integer); procedure SetYIndexCenter(AValue: Integer);
procedure SetYIndexWhiskerMax(AValue: Integer); procedure SetYIndexWhiskerMax(AValue: Integer);
procedure SetYIndexWhiskerMin(AValue: Integer); procedure SetYIndexWhiskerMin(AValue: Integer);
procedure UpdateYDataLayout;
protected protected
procedure GetLegendItems(AItems: TChartLegendItems); override; procedure GetLegendItems(AItems: TChartLegendItems); override;
function GetSeriesColor: TColor; override; function GetSeriesColor: TColor; override;
@ -1405,6 +1406,7 @@ procedure TBoxAndWhiskerSeries.SetYIndexBoxMax(AValue: Integer);
begin begin
if FYIndexBoxMax = AValue then exit; if FYIndexBoxMax = AValue then exit;
FYIndexBoxMax := AValue; FYIndexBoxMax := AValue;
UpdateYDataLayout;
UpdateParentChart; UpdateParentChart;
end; end;
@ -1412,6 +1414,7 @@ procedure TBoxAndWhiskerSeries.SetYIndexBoxMin(AValue: Integer);
begin begin
if FYIndexBoxMin = AValue then exit; if FYIndexBoxMin = AValue then exit;
FYIndexBoxMin := AValue; FYIndexBoxMin := AValue;
UpdateYDataLayout;
UpdateParentChart; UpdateParentChart;
end; end;
@ -1419,6 +1422,7 @@ procedure TBoxAndWhiskerSeries.SetYIndexCenter(AValue: Integer);
begin begin
if FYIndexCenter = AValue then exit; if FYIndexCenter = AValue then exit;
FYIndexCenter := AValue; FYIndexCenter := AValue;
UpdateYDataLayout;
UpdateParentChart; UpdateParentChart;
end; end;
@ -1426,6 +1430,7 @@ procedure TBoxAndWhiskerSeries.SetYIndexWhiskerMax(AValue: Integer);
begin begin
if FYIndexWhiskerMax = AValue then exit; if FYIndexWhiskerMax = AValue then exit;
FYIndexWhiskerMax := AValue; FYIndexWhiskerMax := AValue;
UpdateYDataLayout;
UpdateParentChart; UpdateParentChart;
end; end;
@ -1433,6 +1438,7 @@ procedure TBoxAndWhiskerSeries.SetYIndexWhiskerMin(AValue: Integer);
begin begin
if FYIndexWhiskerMin = AValue then exit; if FYIndexWhiskerMin = AValue then exit;
FYIndexWhiskerMin := AValue; FYIndexWhiskerMin := AValue;
UpdateYDataLayout;
UpdateParentChart; UpdateParentChart;
end; end;
@ -1540,6 +1546,21 @@ begin
end; end;
end; end;
procedure TBoxAndWhiskerSeries.UpdateYDataLayout;
begin
if (FYIndexWhiskerMin = 0) and (FYIndexBoxMin = 1) and (FYIndexCenter = 2) and
(FYIndexBoxMax = 3) and (FYIndexWhiskerMax = 4)
then
FYDataLayout := bwlLegacy
else
if (FYIndexCenter = 0) and (FYIndexWhiskerMin = 1) and (FYIndexBoxMin = 2) and
(FYIndexBoxMax = 3) and (FYIndexWhiskerMax = 4)
then
FYDataLayout := bwlNormal
else
FYDataLayout := bwlCustom;
end;
{ TOpenHighLowCloseSeries } { TOpenHighLowCloseSeries }