fpspreadsheet: xlsx writer supports chart plotarea background and border.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9276 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
94bdea03f5
commit
ef0d96fa34
@ -3259,52 +3259,7 @@ begin
|
|||||||
with TRGBA(Result) do
|
with TRGBA(Result) do
|
||||||
HLStoRGB(round(H*255), round(L*255), round(S*255), R, G, B);
|
HLStoRGB(round(H*255), round(L*255), round(S*255), R, G, B);
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
|
||||||
Returns the input color with its luminance multiplied by the given factor.
|
|
||||||
|
|
||||||
@param AColor rgb color to be modified
|
|
||||||
@param AFactor Factor to be used for the operation
|
|
||||||
@returns Modified color
|
|
||||||
-------------------------------------------------------------------------------}
|
|
||||||
function LumModColor(AColor: TsColor; AFactor: Double): TsColor;
|
|
||||||
var
|
|
||||||
H, L, S: Byte;
|
|
||||||
begin
|
|
||||||
with TRGBA(AColor) do
|
|
||||||
RGBToHLS(R,G,B, H,L,S);
|
|
||||||
L := EnsureRange(round(L*AFactor), 0, 255);
|
|
||||||
with TRGBA(Result) do
|
|
||||||
begin
|
|
||||||
HLSToRGB(H,L,S, R,G,B);
|
|
||||||
A := 0;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
|
||||||
Returns the input color with its luminance shifted, but with its hue and
|
|
||||||
saturation unchanged ([ISO/IEC29500-1:2016] section 20.1.2.3.21)
|
|
||||||
|
|
||||||
@param AColor rgb color to be modified
|
|
||||||
@param AOffset Fraction of the maximum luminance to be added
|
|
||||||
@returns Modified color
|
|
||||||
-------------------------------------------------------------------------------}
|
|
||||||
function LumOffsetColor(AColor: TsColor; AOffset: Double): TsColor;
|
|
||||||
const
|
|
||||||
HLSMAX = 255;
|
|
||||||
var
|
|
||||||
H, L, S: Byte;
|
|
||||||
begin
|
|
||||||
with TRGBA(AColor) do
|
|
||||||
RGBToHLS(R,G,B, H,L,S);
|
|
||||||
L := EnsureRange(round(L + HLSMAX * AOffset), 0, 255);
|
|
||||||
with TRGBA(Result) do
|
|
||||||
begin
|
|
||||||
HLSToRGB(H,L,S, R,G,B);
|
|
||||||
A := 0;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Returns the color index for black or white depending on a color being "bright"
|
Returns the color index for black or white depending on a color being "bright"
|
||||||
or "dark".
|
or "dark".
|
||||||
|
@ -1511,6 +1511,8 @@ begin
|
|||||||
workNode := workNode.NextSibling;
|
workNode := workNode.NextSibling;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
AChart.PlotArea.Background.Color := ChartColor(scWhite);
|
||||||
|
AChart.PlotArea.Background.Style := cfsSolid;
|
||||||
SetAxisDefaults(AChart.XAxis);
|
SetAxisDefaults(AChart.XAxis);
|
||||||
SetAxisDefaults(AChart.YAxis);
|
SetAxisDefaults(AChart.YAxis);
|
||||||
SetAxisDefaults(AChart.X2Axis);
|
SetAxisDefaults(AChart.X2Axis);
|
||||||
@ -1568,6 +1570,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
inc(valAxCounter);
|
inc(valAxCounter);
|
||||||
end;
|
end;
|
||||||
|
'c:spPr':
|
||||||
|
ReadChartFillAndLineProps(workNode.FirstChild, AChart, AChart.PlotArea.Background, AChart.PlotArea.Border);
|
||||||
end;
|
end;
|
||||||
workNode := workNode.NextSibling;
|
workNode := workNode.NextSibling;
|
||||||
end;
|
end;
|
||||||
@ -4210,32 +4214,13 @@ begin
|
|||||||
WriteChartAxisNode(AStream, AIndent, AChart.X2Axis, x2Axkind);
|
WriteChartAxisNode(AStream, AIndent, AChart.X2Axis, x2Axkind);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
// Wrie the
|
// Write the plot area background
|
||||||
if (AChart.GetChartType = ctStock) then
|
AppendToStream(AStream,
|
||||||
begin
|
indent + ' <c:spPr>' + LE +
|
||||||
// Stock series has the y axis first, then the x axis. //// NOT CLEAR IF THIS IS REQUIRED...
|
GetChartFillAndLineXML(AIndent + 4, AChart, AChart.PlotArea.Background, AChart.PlotArea.Border) + LE +
|
||||||
WriteChartAxisNode(AStream, AIndent, AChart.XAxis, 'c:dateAx'); //'c:catAx');
|
indent + ' </c:spPr>' + LE
|
||||||
WriteChartAxisNode(AStream, AIndent, AChart.YAxis, 'c:valAx');
|
);
|
||||||
// WriteChartAxisNode(AStream, AIndent, AChart.XAxis, 'c:dateAx'); //'c:catAx');
|
|
||||||
if hasSecondaryAxis then
|
|
||||||
begin
|
|
||||||
WriteChartAxisNode(AStream, AIndent, AChart.Y2Axis, yAxKind);
|
|
||||||
WriteChartAxisNode(AStream, AIndent, AChart.X2Axis, x2AxKind);
|
|
||||||
end;
|
|
||||||
end else
|
|
||||||
if not (AChart.GetChartType in [ctPie, ctRing]) then
|
|
||||||
begin
|
|
||||||
yAxKind := 'c:valAx';
|
|
||||||
WriteChartAxisNode(AStream, AIndent, AChart.XAxis, xAxKind);
|
|
||||||
WriteChartAxisNode(AStream, AIndent, AChart.YAxis, yAxKind);
|
|
||||||
if hasSecondaryAxis then
|
|
||||||
begin
|
|
||||||
WriteChartAxisNode(AStream, AIndent, AChart.Y2Axis, yAxKind);
|
|
||||||
WriteChartAxisNode(AStream, AIndent, AChart.X2Axis, x2AxKind);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
|
|
||||||
AppendToStream(AStream,
|
AppendToStream(AStream,
|
||||||
indent + '</c:plotArea>' + LE
|
indent + '</c:plotArea>' + LE
|
||||||
|
@ -1489,6 +1489,13 @@ begin
|
|||||||
|
|
||||||
// Clear the footer
|
// Clear the footer
|
||||||
FChart.Foot.Text.Clear;
|
FChart.Foot.Text.Clear;
|
||||||
|
|
||||||
|
// Restore default background
|
||||||
|
FChart.BackColor := clWindow;
|
||||||
|
FChart.Frame.Color := clDefault;
|
||||||
|
FChart.Frame.Width := 1;
|
||||||
|
FChart.Frame.Style := psSolid;
|
||||||
|
FChart.Frame.Visible := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Approximates the empty hatch patterns by the built-in TBrush styles. }
|
{ Approximates the empty hatch patterns by the built-in TBrush styles. }
|
||||||
|
Loading…
Reference in New Issue
Block a user