fpspreadsheet: Some more details for BubbleSeries in xlsx chart writer.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9207 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-02-03 21:46:57 +00:00
parent a19317f379
commit 98f353764d
3 changed files with 15 additions and 3 deletions

View File

@ -54,11 +54,13 @@ begin
ch.XAxis.Title.Caption := 'Distance from Sun (relative to Earth)';
ch.XAxis.MinorGridLines.Style := clsNoLine;
ch.XAxis.Logarithmic := true;
ch.XAxis.Min := 0.1;
ch.XAxis.Max := 100;
ch.YAxis.Title.Caption := 'Orbital period (relative to Earth)';
ch.YAxis.AxisLine.Color := scSilver;
ch.YAxis.MinorGridLines.Style := clsNoLine;
ch.YAxis.Logarithmic := true;
ch.YAxis.Min := 0.1;
ch.YAxis.Max := 1000;
// Add data as bubble series

View File

@ -678,6 +678,7 @@ type
TsBubbleSeries = class(TsCustomScatterSeries)
private
FBubbleRange: TsChartRange;
FBubbleScale: Double;
FBubbleSizeMode: TsBubbleSizeMode;
public
constructor Create(AChart: TsChart); override;
@ -685,6 +686,7 @@ type
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 BubbleScale: Double read FBubbleScale write FBubbleScale;
property BubbleSizeMode: TsBubbleSizeMode read FBubbleSizeMode write FBubbleSizeMode;
end;
@ -2373,6 +2375,7 @@ constructor TsBubbleSeries.Create(AChart: TsChart);
begin
inherited;
FBubbleRange := TsChartRange.Create(AChart);
FBubbleScale := 1.0;
FChartType := ctBubble;
end;

View File

@ -3457,6 +3457,7 @@ procedure TsSpreadOOXMLChartWriter.WriteBubbleSeries(AStream: TStream;
var
indent: String;
chart: TsChart;
diameterMode: String;
begin
indent := DupeString(' ', AIndent);
chart := ASeries.Chart;
@ -3468,19 +3469,25 @@ begin
WriteChartSeriesNode(AStream, AIndent + 2, ASeries, ASeriesIndex);
if ASeries.BubbleSizeMode = bsmRadius then
AppendToStream(AStream,
indent + ' <c:sizeRepresents val="w"/>' + LE
);
AppendToStream(AStream, Format(
indent + ' <c:bubbleScale val="%d"/>' + LE +
indent + ' <c:axId val="%d"/>' + LE +
indent + ' <c:axId val="%d"/>' + LE +
indent + '</c:bubbleChart>' + LE,
[
round(ASeries.BubbleScale*100), // <c:bubbleScale>
FAxisID[ASeries.Chart.XAxis.Alignment], // <c:axId>
FAxisID[ASeries.Chart.YAxis.Alignment] // <c:axId>
]
));
// Note: <c:showNegBubbles> not supported
end;
{@@ ----------------------------------------------------------------------------
Writes the properties of the given chart axis to the chartN.xml file under
the <c:plotArea> node
@ -3601,7 +3608,7 @@ begin
maxStr := indent + Format(' <c:max val="%g"/>', [Axis.Max], FPointSeparatorSettings) + LE;
if not Axis.AutomaticMin then
minStr := indent + Format(' <c:min val="&g"/>', [Axis.Min], FPointSeparatorSettings) + LE;
minStr := indent + Format(' <c:min val="%g"/>', [Axis.Min], FPointSeparatorSettings) + LE;
if Axis.Logarithmic then
logStr := indent + Format(' <c:logBase val="%g"/>', [Axis.LogBase], FPointSeparatorSettings) + LE;