mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-13 05:29:26 +02:00
TAChart: Add FormatIfNotEmpty utility function
git-svn-id: trunk@32136 -
This commit is contained in:
parent
f32263619c
commit
d5ad4ab713
@ -518,12 +518,10 @@ const
|
||||
('Left', 'Top', 'Right', 'Bottom');
|
||||
VISIBLE_NAME: array [Boolean] of String = (' Hidden', '');
|
||||
INVERTED_NAME: array [Boolean] of String = ('', ' Inverted');
|
||||
CAPTION_FMT = ' (%s)';
|
||||
begin
|
||||
Result :=
|
||||
SIDE_NAME[Alignment] + VISIBLE_NAME[Visible] + INVERTED_NAME[Inverted];
|
||||
if Title.Caption <> '' then
|
||||
Result += Format(CAPTION_FMT, [Title.Caption]);
|
||||
SIDE_NAME[Alignment] + VISIBLE_NAME[Visible] + INVERTED_NAME[Inverted] +
|
||||
FormatIfNotEmpty(' (%s)', Title.Caption);
|
||||
end;
|
||||
|
||||
function TChartAxis.GetMarks: TChartAxisMarks;
|
||||
|
@ -248,6 +248,8 @@ procedure Exchange(var A, B: String); overload; inline;
|
||||
|
||||
procedure ExpandRange(var ALo, AHi: Double; ACoeff: Double); inline;
|
||||
|
||||
function FormatIfNotEmpty(AFormat, AStr: String): String; inline;
|
||||
|
||||
function InterpolateRGB(AColor1, AColor2: Integer; ACoeff: Double): Integer;
|
||||
function IntToColorHex(AColor: Integer): String; inline;
|
||||
|
||||
@ -360,6 +362,14 @@ begin
|
||||
AHi += d * ACoeff;
|
||||
end;
|
||||
|
||||
function FormatIfNotEmpty(AFormat, AStr: String): String;
|
||||
begin
|
||||
if AStr = '' then
|
||||
Result := ''
|
||||
else
|
||||
Result := Format(AFormat, [AStr]);
|
||||
end;
|
||||
|
||||
function InterpolateRGB(AColor1, AColor2: Integer; ACoeff: Double): Integer;
|
||||
type
|
||||
TBytes = packed array [1..4] of Byte;
|
||||
|
@ -364,8 +364,7 @@ begin
|
||||
Result := 'stroke:' + ColorToHex(FPen.FPColor) + ';';
|
||||
if FPen.Width <> 1 then
|
||||
Result += 'stroke-width:' + IntToStr(FPen.Width) + ';';
|
||||
if PEN_DASHARRAY[FPen.Style] <> '' then
|
||||
Result += 'stroke-dasharray:' + PEN_DASHARRAY[FPen.Style] + ';';
|
||||
Result += FormatIfNotEmpty('stroke-dasharray:%s;', PEN_DASHARRAY[FPen.Style]);
|
||||
end;
|
||||
|
||||
procedure TSVGDrawer.WriteFmt(const AFormat: String; AParams: array of const);
|
||||
|
Loading…
Reference in New Issue
Block a user