mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 08:19:41 +02:00
TAChart: Better support drawing of too narrow legend panel. Update demo.
git-svn-id: trunk@27785 -
This commit is contained in:
parent
b9412bed2b
commit
16f53a6e50
@ -98,7 +98,7 @@ object Form1: TForm1
|
||||
Left = 0
|
||||
Height = 336
|
||||
Top = 0
|
||||
Width = 332
|
||||
Width = 327
|
||||
AxisList = <
|
||||
item
|
||||
Title.LabelFont.Orientation = 900
|
||||
@ -170,6 +170,14 @@ object Form1: TForm1
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 327
|
||||
Height = 336
|
||||
Top = 0
|
||||
Width = 5
|
||||
Align = alRight
|
||||
ResizeAnchor = akRight
|
||||
end
|
||||
end
|
||||
end
|
||||
object UserDefinedChartSource1: TUserDefinedChartSource
|
||||
|
@ -33,6 +33,7 @@ type
|
||||
Panel1: TPanel;
|
||||
tsDomain: TTabSheet;
|
||||
tsColorMap: TTabSheet;
|
||||
Splitter1: TSplitter;
|
||||
UserDefinedChartSource1: TUserDefinedChartSource;
|
||||
procedure cbDomainChange(Sender: TObject);
|
||||
procedure cbInterpolateChange(Sender: TObject);
|
||||
|
@ -343,6 +343,10 @@ begin
|
||||
ACanvas.Pen.Assign(Frame);
|
||||
ACanvas.Rectangle(ABounds);
|
||||
|
||||
r := ABounds;
|
||||
r.Right -= 1;
|
||||
ACanvas.ClipRect := r;
|
||||
ACanvas.Clipping := true;
|
||||
// Draw items.
|
||||
h := TypicalTextHeight(ACanvas);
|
||||
r := Bounds(ABounds.Left + Spacing, ABounds.Top + Spacing, SymbolWidth, h);
|
||||
@ -373,9 +377,13 @@ begin
|
||||
with AItems[i] as TLegendItem do
|
||||
legendWidth := Max(ACanvas.TextWidth(FText), legendWidth);
|
||||
legendWidth += 2 * Spacing + SYMBOL_TEXT_SPACING + SymbolWidth;
|
||||
w := 2 * MarginX;
|
||||
with AClipRect do
|
||||
legendWidth := EnsureRange(legendWidth, 0, Right - Left - w);
|
||||
w += legendWidth;
|
||||
|
||||
textHeight := TypicalTextHeight(ACanvas);
|
||||
legendHeight := Spacing + AItems.Count * (textHeight + Spacing);
|
||||
w := legendWidth + 2 * MarginX;
|
||||
|
||||
// Determine position according to the alignment.
|
||||
if Alignment in [laTopLeft, laBottomLeft] then begin
|
||||
|
Loading…
Reference in New Issue
Block a user