fpspreadsheet: Support radar charts.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9002 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-10-30 14:56:16 +00:00
parent 2f80394b32
commit 1176d41a94
3 changed files with 27 additions and 4 deletions

View File

@ -8,8 +8,9 @@ const
// SERIES_CLASS: TsChartSeriesClass = TsAreaSeries;
// SERIES_CLASS: TsChartSeriesClass = TsBarSeries;
// SERIES_CLASS: TsChartSeriesClass = TsBubbleSeries;
SERIES_CLASS: TsChartSeriesClass = TsLineSeries;
// SERIES_CLASS: TsChartSeriesClass = TsLineSeries;
// SERIES_CLASS: TsChartSeriesClass = TsScatterSeries;
SERIES_CLASS: TsChartSeriesClass = TsRadarSeries;
r1 = 1;
r2 = 8;
FILL_COLORS: array[0..r2-r1] of TsColor = (scRed, scGreen, scBlue, scYellow, scMagenta, scSilver, scBlack, scOlive);

View File

@ -113,7 +113,7 @@ type
TsChartAxisPosition = (capStart, capEnd, capValue);
TsChartAxisTick = (catInside, catOutside);
TsChartAxisTicks = set of TsChartAxisTick;
TsChartType = (ctEmpty, ctBar, ctLine, ctArea, ctBarLine, ctScatter, ctBubble);
TsChartType = (ctEmpty, ctBar, ctLine, ctArea, ctBarLine, ctScatter, ctBubble, ctRadar);
TsChartAxis = class(TsChartFillElement)
private
@ -287,6 +287,11 @@ type
property ShowSymbols: Boolean read FShowSymbols write FShowSymbols;
end;
TsRadarSeries = class(TsLineSeries)
public
constructor Create(AChart: TsChart); override;
end;
TsScatterSeries = class(TsLineSeries)
public
constructor Create(AChart: TsChart); override;
@ -799,6 +804,14 @@ begin
end;
{ TsRadarSeries }
constructor TsRadarSeries.Create(AChart: TsChart);
begin
inherited Create(AChart);
FChartType := ctRadar;
end;
{ TsScatterSeries }
constructor TsScatterSeries.Create(AChart: TsChart);

View File

@ -73,7 +73,7 @@ const
OPENDOC_PATH_CHART_STYLES = 'Object %d/styles.xml';
CHART_TYPE_NAMES: array[TsChartType] of string = (
'', 'bar', 'line', 'area', 'barLine', 'scatter', 'bubble'
'', 'bar', 'line', 'area', 'barLine', 'scatter', 'bubble', 'radar'
);
CHART_SYMBOL_NAMES: array[TsChartSeriesSymbol] of String = (
@ -446,6 +446,7 @@ var
interpolationStr: String = '';
verticalStr: String = '';
stackModeStr: String = '';
rightAngledAxes: String = '';
begin
indent := DupeString(' ', AIndent);
@ -468,6 +469,9 @@ begin
ciStepCenterY: interpolationStr := 'chart:interpolation="step-center-y" ';
end;
if AChart.GetChartType <> ctRadar then
rightAngledAxes := 'chart:right-angled-axes="true" ';
Result := Format(
indent + ' <style:style style:name="ch%d" style:family="chart">', [ AStyleID ]) + LE +
indent + ' <style:chart-properties ' +
@ -479,7 +483,8 @@ begin
'chart:auto-position="true" ' +
'chart:auto-size="true" ' +
'chart:treat-empty-cells="leave-gap" ' +
'chart:right-angled-axes="true"/>' + LE +
rightAngledAxes +
'/>' + LE +
indent + ' </style:style>' + LE;
end;
@ -526,7 +531,11 @@ begin
FPointSeparatorSettings
);
end;
chartProps := chartProps + 'chart:link-data-style-to-source="true" ';
// to do: link-data-style-to-source must go to "false" in case of a specific
// numeric label format. But that requires a number-style in the Object/style.xml
if ([cdlValue, cdlPercentage] * series.DataLabels = [cdlValue]) then
chartProps := chartProps + 'chart:data-label-number="value" '
else