fpspreadsheet: More support of series data labels in xlsx reader. Bubble series shows bubble size in proportion to area now.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9146 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-01-16 22:39:27 +00:00
parent dbe0f0dec5
commit e8e00456d3
5 changed files with 43 additions and 34 deletions

View File

@ -69,11 +69,6 @@
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>

View File

@ -649,15 +649,19 @@ type
property ShowSymbols;
end;
TsBubbleSizeMode = (bsmRadius, bsmArea);
TsBubbleSeries = class(TsCustomScatterSeries)
private
FBubbleRange: TsChartRange;
FBubbleSizeMode: TsBubbleSizeMode;
public
constructor Create(AChart: TsChart); override;
destructor Destroy; override;
procedure SetBubbleRange(ARow1, ACol1, ARow2, ACol2: Cardinal);
procedure SetBubbleRange(ASheet1: String; ARow1, ACol1: Cardinal; ASheet2: String; ARow2, ACol2: Cardinal);
property BubbleRange: TsChartRange read FBubbleRange;
property BubbleSizeMode: TsBubbleSizeMode read FBubbleSizeMode write FBubbleSizeMode;
end;
TsStockSeries = class(TsCustomScatterSeries)

View File

@ -1456,7 +1456,10 @@ begin
end
else
if (series is TsBubbleSeries) then
ReadChartCellRange(ANode, 'chart:values-cell-range-address', TsBubbleSeries(series).BubbleRange)
begin
TsBubbleSeries(series).BubbleSizeMode := bsmArea;
ReadChartCellRange(ANode, 'chart:values-cell-range-address', TsBubbleSeries(series).BubbleRange);
end
else
ReadChartCellRange(ANode, 'chart:values-cell-range-address', series.YRange);

View File

@ -167,6 +167,11 @@ begin
begin
nodeName := ANode.NodeName;
case nodeName of
'c:ser':
begin
ser := TsAreaSeries.Create(AChart);
ReadChartSeriesProps(ANode.FirstChild, ser);
end;
'c:grouping':
begin
s := GetAttrValue(ANode, 'val');
@ -177,11 +182,6 @@ begin
end;
'c:varyColors':
;
'c:ser':
begin
ser := TsAreaSeries.Create(AChart);
ReadChartSeriesProps(ANode.FirstChild, ser);
end;
'c:dLbls':
;
'c:axId':
@ -340,6 +340,11 @@ begin
begin
nodeName := ANode.NodeName;
case nodeName of
'c:ser':
begin
ser := TsBarSeries.Create(AChart);
ReadChartSeriesProps(ANode.FirstChild, ser);
end;
'c:barDir':
begin
s := GetAttrValue(ANode, 'val');
@ -358,11 +363,6 @@ begin
end;
'c:varyColors':
;
'c:ser':
begin
ser := TsBarSeries.Create(AChart);
ReadChartSeriesProps(ANode.FirstChild, ser);
end;
'c:dLbls':
s := '';
'c:gapWidth':
@ -412,14 +412,15 @@ begin
nodeName := ANode.NodeName;
s := GetAttrValue(ANode, 'val');
case nodeName of
'c:bubbleScale': ;
'c:showNegBubbles': ;
'c:varyColors': ;
'c:ser':
begin
ser := TsBubbleSeries.Create(AChart);
ser.BubbleSizeMode := bsmArea; // Excel always plots the area of the bubbles
ReadChartSeriesProps(ANode.FirstChild, ser);
end;
'c:bubbleScale': ;
'c:showNegBubbles': ;
'c:varyColors': ;
'c:dLbls':
;
'c:axId':
@ -830,6 +831,12 @@ begin
begin
nodeName := ANode.NodeName;
case nodeName of
'c:ser':
begin
ser := TsLineSeries.Create(AChart);
ReadChartSeriesMarker(ANode.FirstChild, TsLineSeries(ser));
ReadChartSeriesProps(ANode.FirstChild, ser);
end;
'c:grouping':
begin
s := GetAttrValue(ANode, 'val');
@ -840,12 +847,6 @@ begin
end;
'c:varyColors':
;
'c:ser':
begin
ser := TsLineSeries.Create(AChart);
ReadChartSeriesMarker(ANode.FirstChild, TsLineSeries(ser));
ReadChartSeriesProps(ANode.FirstChild, ser);
end;
'c:dLbls':
;
'c:gapWidth':
@ -1078,18 +1079,18 @@ begin
begin
nodeName := ANode.NodeName;
case nodeName of
'c:scatterStyle':
begin
s := GetAttrValue(ANode, 'val');
smooth := (s = 'smoothMarker'); // to do: use it to create a spline series when true.
end;
'c:varyColors': ;
'c:ser':
begin
ser := TsScatterSeries.Create(AChart);
ReadChartSeriesMarker(ANode.FirstChild, TsScatterSeries(ser));
ReadChartSeriesProps(ANode.FirstChild, ser);
end;
'c:scatterStyle':
begin
s := GetAttrValue(ANode, 'val');
smooth := (s = 'smoothMarker'); // to do: use it to create a spline series when true.
end;
'c:varyColors': ;
'c:dLbls':
;
'c:axId':
@ -1282,6 +1283,8 @@ begin
end;
end;
end;
'c:dlblPos':
;
'c:showLegendKey':
if (s <> '') and (s <> '0') then
ASeries.DataLabels := ASeries.DataLabels + [cdlSymbol];
@ -1298,7 +1301,8 @@ begin
if (s <> '') and (s <> '0') then
ASeries.DataLabels := ASeries.DataLabels + [cdlPercentage];
'c:showBubbleSize':
;
if (s <> '') and (s <> '0') and (ASeries is TsBubbleSeries) then
ASeries.DataLabels := ASeries.DataLabels + [cdlValue];
'c:showLeaderLines':
;
'c:extLst':
@ -1340,7 +1344,7 @@ begin
'c:spPr':
ReadChartFillAndLineProps(ANode.FirstChild, ASeries.Chart, ASeries.Fill, ASeries.Line);
'c:dLbls':
ReadChartSeriesLabels(ANode.Firstchild, ASeries);
ReadChartSeriesLabels(ANode.FirstChild, ASeries);
'c:trendline':
ReadChartSeriesTrendLine(ANode.FirstChild, ASeries);
'c:errBars':

View File

@ -1839,7 +1839,10 @@ begin
AChartSeries.Transparency := round(255*AWorkbookSeries.Fill.Transparency);
{$IF LCL_FullVersion >= 3990000}
AChartSeries.BubbleRadiusUnits := bruPercentage;
case AWorkbookSeries.BubbleSizeMode of
bsmRadius: AChartSeries.BubbleRadiusUnits := bruPercentageRadius;
bsmArea: AChartSeries.BubbleRadiusUnits := bruPercentageArea;
end;
AChartSeries.ParentChart.ExpandPercentage := 10;
{$IFEND}