mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 11:19:14 +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');
|
('Left', 'Top', 'Right', 'Bottom');
|
||||||
VISIBLE_NAME: array [Boolean] of String = (' Hidden', '');
|
VISIBLE_NAME: array [Boolean] of String = (' Hidden', '');
|
||||||
INVERTED_NAME: array [Boolean] of String = ('', ' Inverted');
|
INVERTED_NAME: array [Boolean] of String = ('', ' Inverted');
|
||||||
CAPTION_FMT = ' (%s)';
|
|
||||||
begin
|
begin
|
||||||
Result :=
|
Result :=
|
||||||
SIDE_NAME[Alignment] + VISIBLE_NAME[Visible] + INVERTED_NAME[Inverted];
|
SIDE_NAME[Alignment] + VISIBLE_NAME[Visible] + INVERTED_NAME[Inverted] +
|
||||||
if Title.Caption <> '' then
|
FormatIfNotEmpty(' (%s)', Title.Caption);
|
||||||
Result += Format(CAPTION_FMT, [Title.Caption]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChartAxis.GetMarks: TChartAxisMarks;
|
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;
|
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 InterpolateRGB(AColor1, AColor2: Integer; ACoeff: Double): Integer;
|
||||||
function IntToColorHex(AColor: Integer): String; inline;
|
function IntToColorHex(AColor: Integer): String; inline;
|
||||||
|
|
||||||
@ -360,6 +362,14 @@ begin
|
|||||||
AHi += d * ACoeff;
|
AHi += d * ACoeff;
|
||||||
end;
|
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;
|
function InterpolateRGB(AColor1, AColor2: Integer; ACoeff: Double): Integer;
|
||||||
type
|
type
|
||||||
TBytes = packed array [1..4] of Byte;
|
TBytes = packed array [1..4] of Byte;
|
||||||
|
@ -364,8 +364,7 @@ begin
|
|||||||
Result := 'stroke:' + ColorToHex(FPen.FPColor) + ';';
|
Result := 'stroke:' + ColorToHex(FPen.FPColor) + ';';
|
||||||
if FPen.Width <> 1 then
|
if FPen.Width <> 1 then
|
||||||
Result += 'stroke-width:' + IntToStr(FPen.Width) + ';';
|
Result += 'stroke-width:' + IntToStr(FPen.Width) + ';';
|
||||||
if PEN_DASHARRAY[FPen.Style] <> '' then
|
Result += FormatIfNotEmpty('stroke-dasharray:%s;', PEN_DASHARRAY[FPen.Style]);
|
||||||
Result += 'stroke-dasharray:' + PEN_DASHARRAY[FPen.Style] + ';';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSVGDrawer.WriteFmt(const AFormat: String; AParams: array of const);
|
procedure TSVGDrawer.WriteFmt(const AFormat: String; AParams: array of const);
|
||||||
|
Loading…
Reference in New Issue
Block a user