mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 19:02:31 +02:00
TAChart: Improved legend symbol for TPolarSeries.
This commit is contained in:
parent
dd306bb20e
commit
07f7a1931e
@ -101,6 +101,17 @@ type
|
|||||||
procedure Draw(ADrawer: IChartDrawer; const ARect: TRect); override;
|
procedure Draw(ADrawer: IChartDrawer; const ARect: TRect); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TLegendItemLinePointerBrush }
|
||||||
|
|
||||||
|
TLegendItemLinePointerBrush = class(TLegendItemLinePointer)
|
||||||
|
strict protected
|
||||||
|
FUseBrush: Boolean;
|
||||||
|
public
|
||||||
|
constructor Create(APen: TPen; ABrush: TBrush; APointer: TSeriesPointer;
|
||||||
|
const AText: String);
|
||||||
|
procedure Draw(ADrawer: IChartDrawer; const ARect: TRect); override;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TLegendItemBrushRect }
|
{ TLegendItemBrushRect }
|
||||||
|
|
||||||
TLegendItemBrushRect = class(TLegendItem)
|
TLegendItemBrushRect = class(TLegendItem)
|
||||||
@ -516,6 +527,29 @@ begin
|
|||||||
FPointer.DrawSize(ADrawer, c, sz, Color, 0.0, FPresetBrush);
|
FPointer.DrawSize(ADrawer, c, sz, Color, 0.0, FPresetBrush);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TLegendItemLinePointerBrush }
|
||||||
|
|
||||||
|
constructor TLegendItemLinePointerBrush.Create(APen: TPen; ABrush: TBrush;
|
||||||
|
APointer: TSeriesPointer; const AText: String);
|
||||||
|
begin
|
||||||
|
CreateWithBrush(APen, ABrush, APointer, AText);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLegendItemLinePointerBrush.Draw(
|
||||||
|
ADrawer: IChartDrawer; const ARect: TRect);
|
||||||
|
begin
|
||||||
|
ADrawer.SetBrush(FBrush);
|
||||||
|
if Assigned(FPointer) then
|
||||||
|
begin
|
||||||
|
ADrawer.FillRect(ARect.Left, (ARect.Top + ARect.Bottom) div 2, ARect.Right, ARect.Bottom);
|
||||||
|
FPresetBrush := false;
|
||||||
|
ADrawer.SetBrush(FPointer.Brush);
|
||||||
|
end;
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TLegendItemBrushRect }
|
{ TLegendItemBrushRect }
|
||||||
|
|
||||||
constructor TLegendItemBrushRect.Create(
|
constructor TLegendItemBrushRect.Create(
|
||||||
|
@ -1357,7 +1357,13 @@ begin
|
|||||||
|
|
||||||
case Legend.Multiplicity of
|
case Legend.Multiplicity of
|
||||||
lmSingle:
|
lmSingle:
|
||||||
AItems.Add(TLegendItemLinePointer.Create(LinePen, p, LegendTextSingle));
|
if Filled then begin
|
||||||
|
if ShowPoints then
|
||||||
|
AItems.Add(TLegendItemLinePointerBrush.Create(LinePen, Brush, p, LegendTextSingle))
|
||||||
|
else
|
||||||
|
AItems.Add(TLegendItemBrushPenRect.Create(Brush, LinePen, LegendTextSingle));
|
||||||
|
end else
|
||||||
|
AItems.Add(TLegendItemLinePointer.Create(LinePen, p, LegendTextSingle));
|
||||||
lmPoint:
|
lmPoint:
|
||||||
for i := 0 to Count - 1 do begin
|
for i := 0 to Count - 1 do begin
|
||||||
li := TLegendItemLinePointer.Create(LinePen, p, LegendTextPoint(i));
|
li := TLegendItemLinePointer.Create(LinePen, p, LegendTextPoint(i));
|
||||||
|
Loading…
Reference in New Issue
Block a user