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
|
||||
HLStoRGB(round(H*255), round(L*255), round(S*255), R, G, B);
|
||||
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"
|
||||
or "dark".
|
||||
|
@ -1511,6 +1511,8 @@ begin
|
||||
workNode := workNode.NextSibling;
|
||||
end;
|
||||
|
||||
AChart.PlotArea.Background.Color := ChartColor(scWhite);
|
||||
AChart.PlotArea.Background.Style := cfsSolid;
|
||||
SetAxisDefaults(AChart.XAxis);
|
||||
SetAxisDefaults(AChart.YAxis);
|
||||
SetAxisDefaults(AChart.X2Axis);
|
||||
@ -1568,6 +1570,8 @@ begin
|
||||
end;
|
||||
inc(valAxCounter);
|
||||
end;
|
||||
'c:spPr':
|
||||
ReadChartFillAndLineProps(workNode.FirstChild, AChart, AChart.PlotArea.Background, AChart.PlotArea.Border);
|
||||
end;
|
||||
workNode := workNode.NextSibling;
|
||||
end;
|
||||
@ -4210,32 +4214,13 @@ begin
|
||||
WriteChartAxisNode(AStream, AIndent, AChart.X2Axis, x2Axkind);
|
||||
end;
|
||||
end;
|
||||
(*
|
||||
// Wrie the
|
||||
if (AChart.GetChartType = ctStock) then
|
||||
begin
|
||||
// Stock series has the y axis first, then the x axis. //// NOT CLEAR IF THIS IS REQUIRED...
|
||||
WriteChartAxisNode(AStream, AIndent, AChart.XAxis, 'c:dateAx'); //'c:catAx');
|
||||
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;
|
||||
*)
|
||||
|
||||
// Write the plot area background
|
||||
AppendToStream(AStream,
|
||||
indent + ' <c:spPr>' + LE +
|
||||
GetChartFillAndLineXML(AIndent + 4, AChart, AChart.PlotArea.Background, AChart.PlotArea.Border) + LE +
|
||||
indent + ' </c:spPr>' + LE
|
||||
);
|
||||
|
||||
AppendToStream(AStream,
|
||||
indent + '</c:plotArea>' + LE
|
||||
|
@ -1489,6 +1489,13 @@ begin
|
||||
|
||||
// Clear the footer
|
||||
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;
|
||||
|
||||
{ Approximates the empty hatch patterns by the built-in TBrush styles. }
|
||||
|
Loading…
Reference in New Issue
Block a user