mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-05 10:19:39 +01:00
TAChart: Add TChartLegend.ItemFillOrder property
git-svn-id: trunk@33137 -
This commit is contained in:
parent
43ef33f4aa
commit
fe56ad9f43
@ -149,6 +149,7 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
TLegendColumnCount = 1..MaxInt;
|
TLegendColumnCount = 1..MaxInt;
|
||||||
|
TLegendItemFillOrder = (lfoColRow, lfoRowCol);
|
||||||
|
|
||||||
{ TChartLegend }
|
{ TChartLegend }
|
||||||
|
|
||||||
@ -161,6 +162,7 @@ type
|
|||||||
FFrame: TChartPen;
|
FFrame: TChartPen;
|
||||||
FGroupFont: TFont;
|
FGroupFont: TFont;
|
||||||
FGroupTitles: TStrings;
|
FGroupTitles: TStrings;
|
||||||
|
FItemFillOrder: TLegendItemFillOrder;
|
||||||
FMarginX: TChartDistance;
|
FMarginX: TChartDistance;
|
||||||
FMarginY: TChartDistance;
|
FMarginY: TChartDistance;
|
||||||
FSpacing: TChartDistance;
|
FSpacing: TChartDistance;
|
||||||
@ -175,6 +177,7 @@ type
|
|||||||
procedure SetFrame(AValue: TChartPen);
|
procedure SetFrame(AValue: TChartPen);
|
||||||
procedure SetGroupFont(AValue: TFont);
|
procedure SetGroupFont(AValue: TFont);
|
||||||
procedure SetGroupTitles(AValue: TStrings);
|
procedure SetGroupTitles(AValue: TStrings);
|
||||||
|
procedure SetItemFillOrder(AValue: TLegendItemFillOrder);
|
||||||
procedure SetMargin(AValue: TChartDistance);
|
procedure SetMargin(AValue: TChartDistance);
|
||||||
procedure SetMarginX(AValue: TChartDistance);
|
procedure SetMarginX(AValue: TChartDistance);
|
||||||
procedure SetMarginY(AValue: TChartDistance);
|
procedure SetMarginY(AValue: TChartDistance);
|
||||||
@ -206,6 +209,8 @@ type
|
|||||||
property Frame: TChartPen read FFrame write SetFrame;
|
property Frame: TChartPen read FFrame write SetFrame;
|
||||||
property GroupFont: TFont read FGroupFont write SetGroupFont;
|
property GroupFont: TFont read FGroupFont write SetGroupFont;
|
||||||
property GroupTitles: TStrings read FGroupTitles write SetGroupTitles;
|
property GroupTitles: TStrings read FGroupTitles write SetGroupTitles;
|
||||||
|
property ItemFillOrder: TLegendItemFillOrder
|
||||||
|
read FItemFillOrder write SetItemFillOrder default lfoColRow;
|
||||||
property Margin: TChartDistance
|
property Margin: TChartDistance
|
||||||
read FMarginX write SetMargin stored false; deprecated;
|
read FMarginX write SetMargin stored false; deprecated;
|
||||||
property MarginX: TChartDistance
|
property MarginX: TChartDistance
|
||||||
@ -493,7 +498,7 @@ end;
|
|||||||
|
|
||||||
procedure TChartLegend.Draw(var AData: TChartLegendDrawingData);
|
procedure TChartLegend.Draw(var AData: TChartLegendDrawingData);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i, x, y: Integer;
|
||||||
r: TRect;
|
r: TRect;
|
||||||
prevFont: TFont = nil;
|
prevFont: TFont = nil;
|
||||||
drawer: IChartDrawer;
|
drawer: IChartDrawer;
|
||||||
@ -520,10 +525,15 @@ begin
|
|||||||
drawer.Pen := SymbolFrame
|
drawer.Pen := SymbolFrame
|
||||||
else
|
else
|
||||||
drawer.SetPenParams(psClear, clTAColor);
|
drawer.SetPenParams(psClear, clTAColor);
|
||||||
|
x := 0;
|
||||||
|
y := 0;
|
||||||
|
case ItemFillOrder of
|
||||||
|
lfoColRow: DivMod(i, FRowCount, x, y);
|
||||||
|
lfoRowCol: DivMod(i, FColCount, y, x);
|
||||||
|
end;
|
||||||
r := Bounds(
|
r := Bounds(
|
||||||
FBounds.Left + Spacing + i div FRowCount * (FItemSize.X + Spacing),
|
FBounds.Left + Spacing + x * (FItemSize.X + Spacing),
|
||||||
FBounds.Top + Spacing + i mod FRowCount * (FItemSize.Y + Spacing),
|
FBounds.Top + Spacing + y * (FItemSize.Y + Spacing),
|
||||||
SymbolWidth, FItemSize.Y);
|
SymbolWidth, FItemSize.Y);
|
||||||
FItems[i].Draw(drawer, r);
|
FItems[i].Draw(drawer, r);
|
||||||
OffsetRect(r, 0, FItemSize.Y + Spacing);
|
OffsetRect(r, 0, FItemSize.Y + Spacing);
|
||||||
@ -649,6 +659,13 @@ begin
|
|||||||
StyleChanged(Self);
|
StyleChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChartLegend.SetItemFillOrder(AValue: TLegendItemFillOrder);
|
||||||
|
begin
|
||||||
|
if FItemFillOrder = AValue then exit;
|
||||||
|
FItemFillOrder := AValue;
|
||||||
|
StyleChanged(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChartLegend.SetMargin(AValue: TChartDistance);
|
procedure TChartLegend.SetMargin(AValue: TChartDistance);
|
||||||
begin
|
begin
|
||||||
SetMarginX(AValue);
|
SetMarginX(AValue);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user