fpspreadsheet: Improved support of separator in data point label elements of charts.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9218 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
79b9ec99f3
commit
efcf55181b
@ -54,7 +54,7 @@ begin
|
|||||||
ser.SetLabelRange(4, 0, 8, 0);
|
ser.SetLabelRange(4, 0, 8, 0);
|
||||||
ser.SetYRange(4, 1, 8, 1);
|
ser.SetYRange(4, 1, 8, 1);
|
||||||
ser.DataLabels := [cdlCategory, cdlValue];
|
ser.DataLabels := [cdlCategory, cdlValue];
|
||||||
ser.LabelSeparator := '\n'; // this is the symbol for a line-break
|
ser.LabelSeparator := #10; // '\n'; // this is the symbol for a line-break
|
||||||
ser.LabelPosition := lpOutside;
|
ser.LabelPosition := lpOutside;
|
||||||
ser.LabelFormat := '#,##0';
|
ser.LabelFormat := '#,##0';
|
||||||
|
|
||||||
|
@ -1690,6 +1690,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
nodeName := childNode2.NodeName;
|
nodeName := childNode2.NodeName;
|
||||||
if nodeName = 'text:p' then
|
if nodeName = 'text:p' then
|
||||||
|
begin
|
||||||
|
ASeries.LabelSeparator := GetNodeValue(childNode2);
|
||||||
|
if ASeries.LabelSeparator = '' then
|
||||||
begin
|
begin
|
||||||
childNode3 := childNode2.FirstChild;
|
childNode3 := childNode2.FirstChild;
|
||||||
while childNode3 <> nil do
|
while childNode3 <> nil do
|
||||||
@ -1703,6 +1706,7 @@ begin
|
|||||||
childNode3 := childNode3.NextSibling;
|
childNode3 := childNode3.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
childNode2 := childNode2.NextSibling;
|
childNode2 := childNode2.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2825,8 +2829,14 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
labelSeparator := series.LabelSeparator;
|
labelSeparator := series.LabelSeparator;
|
||||||
if pos('\n', labelSeparator) > 0 then
|
if (pos('\n', labelSeparator) > 0) then
|
||||||
labelSeparator := StringReplace(labelSeparator, '\n', '<text:line-break/>', [rfReplaceAll, rfIgnoreCase]);
|
labelSeparator := StringReplace(labelSeparator, '\n', '<text:line-break/>', [rfReplaceAll, rfIgnoreCase])
|
||||||
|
else if (pos(#13#10, labelSeparator) > 0) then
|
||||||
|
labelSeparator := StringReplace(labelSeparator, #13#10, '<text:line-break/>', [rfReplaceAll, rfIgnoreCase])
|
||||||
|
else if (pos(#10, labelSeparator) > 0) then
|
||||||
|
labelSeparator := StringReplace(labelSeparator, #10, '<text:line-break/>', [rfReplaceAll, rfIgnoreCase])
|
||||||
|
else if (pos(#13, labelSeparator) > 0) then
|
||||||
|
labelSeparator := StringReplace(labelSeparator, #13, '<text:line-break/>', [rfReplaceAll, rfIgnoreCase]);
|
||||||
labelSeparator :=
|
labelSeparator :=
|
||||||
indent + ' <chart:label-separator>' + LE +
|
indent + ' <chart:label-separator>' + LE +
|
||||||
indent + ' <text:p>' + labelSeparator + '</text:p>' + LE +
|
indent + ' <text:p>' + labelSeparator + '</text:p>' + LE +
|
||||||
@ -3966,24 +3976,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
|
||||||
for i := 0 to count - 1 do
|
|
||||||
begin
|
|
||||||
if (i >= series.DataPointStyles.Count) or (series.DataPointStyles[i] = nil) then
|
|
||||||
AppendToStream(AChartStream,
|
|
||||||
indent + ' <chart:data-point chart:repeated="1" />' + LE
|
|
||||||
)
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
AppendToStream(AChartStream, Format(
|
|
||||||
indent + ' <chart:data-point chart:style-name="ch%d" />' + LE, // ToDo: could contain "chart:repeated"
|
|
||||||
[ dataStyleID + i]
|
|
||||||
));
|
|
||||||
inc(nextStyleID);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
}
|
|
||||||
AppendToStream(AChartStream,
|
AppendToStream(AChartStream,
|
||||||
indent + '</chart:series>' + LE
|
indent + '</chart:series>' + LE
|
||||||
);
|
);
|
||||||
@ -4034,19 +4026,6 @@ begin
|
|||||||
inc(dataStyleID);
|
inc(dataStyleID);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
|
|
||||||
for i := 0 to series.DataPointStyles.Count - 1 do
|
|
||||||
begin
|
|
||||||
datapointStyle := series.DatapointStyles[i];
|
|
||||||
for j := prevIdx+1 to datapointStyle.DataPointIndex-1 then;
|
|
||||||
|
|
||||||
AppendToStream(AStyleStream,
|
|
||||||
GetChartSeriesDataPointStyleAsXML(AChart, ASeriesIndex, i, AStyleIndent, dataStyleID)
|
|
||||||
);
|
|
||||||
inc(dataStyleID);
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
|
|
||||||
// Next style
|
// Next style
|
||||||
AStyleID := nextStyleID;
|
AStyleID := nextStyleID;
|
||||||
|
@ -1866,6 +1866,12 @@ begin
|
|||||||
child1 := child1.NextSibling;
|
child1 := child1.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
'c:separator':
|
||||||
|
begin
|
||||||
|
s := GetNodeValue(ANode);
|
||||||
|
if (s = #10) or (s = #13#10) or (s = #13) then s := LineEnding;
|
||||||
|
ASeries.LabelSeparator := s;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
ANode := ANode.NextSibling;
|
ANode := ANode.NextSibling;
|
||||||
end;
|
end;
|
||||||
@ -4055,12 +4061,26 @@ procedure TsSpreadOOXMLChartWriter.WriteChartSeriesDatapointLabels(AStream: TStr
|
|||||||
AIndent: Integer; ASeries: TsChartSeries);
|
AIndent: Integer; ASeries: TsChartSeries);
|
||||||
var
|
var
|
||||||
indent: String;
|
indent: String;
|
||||||
|
separator: String = '';
|
||||||
begin
|
begin
|
||||||
if ASeries.DataLabels = [] then
|
if ASeries.DataLabels = [] then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
indent := DupeString(' ', AIndent);
|
indent := DupeString(' ', AIndent);
|
||||||
|
|
||||||
|
separator := trim(ASeries.LabelSeparator);
|
||||||
|
|
||||||
|
case ASeries.LabelSeparator of
|
||||||
|
'\n', #10, #13, #13#10:
|
||||||
|
separator := FPS_LINE_ENDING; // Excel wants #10
|
||||||
|
' ':
|
||||||
|
separator := '';
|
||||||
|
else
|
||||||
|
separator := ASeries.LabelSeparator;
|
||||||
|
end;
|
||||||
|
if separator <> '' then
|
||||||
|
separator := indent + ' <c:separator>' + separator + '</c:separator>' + LE;
|
||||||
|
|
||||||
AppendToStream(AStream, Format(
|
AppendToStream(AStream, Format(
|
||||||
indent + '<c:dLbls>' + LE +
|
indent + '<c:dLbls>' + LE +
|
||||||
indent + ' <c:spPr>' + LE +
|
indent + ' <c:spPr>' + LE +
|
||||||
@ -4073,6 +4093,7 @@ begin
|
|||||||
indent + ' <c:showPercent val="%d"/>' + LE +
|
indent + ' <c:showPercent val="%d"/>' + LE +
|
||||||
indent + ' <c:showBubbleSize val="%d"/>' + LE +
|
indent + ' <c:showBubbleSize val="%d"/>' + LE +
|
||||||
indent + ' <c:showLeaderLines val="%d"/>' + LE +
|
indent + ' <c:showLeaderLines val="%d"/>' + LE +
|
||||||
|
separator +
|
||||||
indent + '</c:dLbls>' + LE,
|
indent + '</c:dLbls>' + LE,
|
||||||
[
|
[
|
||||||
FALSE_TRUE[cdlSymbol in ASeries.DataLabels],
|
FALSE_TRUE[cdlSymbol in ASeries.DataLabels],
|
||||||
|
@ -2428,10 +2428,8 @@ procedure TsWorkbookChartLink.UpdateChartSeriesMarks(AWorkbookSeries: TsChartSer
|
|||||||
AChartSeries: TChartSeries);
|
AChartSeries: TChartSeries);
|
||||||
begin
|
begin
|
||||||
ConstructSeriesMarks(AWorkbookSeries, AChartSeries);
|
ConstructSeriesMarks(AWorkbookSeries, AChartSeries);
|
||||||
AChartSeries.Marks.LinkPen.Visible := false;
|
|
||||||
|
|
||||||
AChartSeries.Marks.YIndex := -1;
|
AChartSeries.Marks.YIndex := -1;
|
||||||
AChartSeries.Marks.Distance := 20;
|
|
||||||
AChartSeries.Marks.Attachment := maDefault;
|
AChartSeries.Marks.Attachment := maDefault;
|
||||||
Convert_sFont_to_Font(AWorkbookSeries.LabelFont, AChartSeries.Marks.LabelFont);
|
Convert_sFont_to_Font(AWorkbookSeries.LabelFont, AChartSeries.Marks.LabelFont);
|
||||||
|
|
||||||
@ -2496,6 +2494,13 @@ begin
|
|||||||
lcsEllipseWedge: AChartSeries.Marks.Shape := clsEllipse; // replacement
|
lcsEllipseWedge: AChartSeries.Marks.Shape := clsEllipse; // replacement
|
||||||
else AChartSeries.Marks.Shape := clsRectangle; // replacement
|
else AChartSeries.Marks.Shape := clsRectangle; // replacement
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
AChartSeries.Marks.LinkPen.Visible := (cdlLeaderLines in AWorkbookSeries.DataLabels);
|
||||||
|
AChartSeries.Marks.LinkPen.Color := AChartSeries.Marks.Frame.Color;
|
||||||
|
if AChartSeries.Marks.LinkPen.Visible then
|
||||||
|
AChartSeries.Marks.Distance := 20
|
||||||
|
else
|
||||||
|
AChartSeries.Marks.Distance := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsWorkbookChartLink.UpdateChartSeriesTrendline(AWorkbookSeries: TsChartSeries;
|
procedure TsWorkbookChartLink.UpdateChartSeriesTrendline(AWorkbookSeries: TsChartSeries;
|
||||||
|
Loading…
Reference in New Issue
Block a user