fpspreadsheet: Build styles from some chart properties

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8975 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-10-23 18:21:54 +00:00
parent 6beb21eab9
commit f2323fdf82
4 changed files with 798 additions and 211 deletions

View File

@ -47,6 +47,21 @@ begin
ch.PlotArea.Background.Style := fsSolidFill; ch.PlotArea.Background.Style := fsSolidFill;
ch.PlotArea.Background.FgColor := $F0F0F0; ch.PlotArea.Background.FgColor := $F0F0F0;
{$ENDIF} {$ENDIF}
ch.XAxis.ShowLabels := true;
ch.XAxis.LabelFont.Size := 8;
ch.XAxis.LabelFont.Color := scRed;
ch.XAxis.AxisLine.Color := scRed;
ch.XAxis.CaptionFont.Color := scRed;
ch.XAxis.CaptionFont.Size := 12;
ch.YAxis.ShowLabels := true;
ch.YAxis.LabelFont.Size := 8;
ch.YAxis.LabelFont.Color := scBlue;
ch.YAxis.AxisLine.Color := scBlue;
ch.YAxis.CaptionFont.Color := scBlue;
ch.YAxis.CaptionFont.Size := 12;
ch.YAxis.LabelRotation := 90;
ch.YAxis.CaptionRotation := 90;
ch.Title.Caption := 'HALLO'; ch.Title.Caption := 'HALLO';
ch.Title.Visible := true; ch.Title.Visible := true;
@ -54,8 +69,8 @@ begin
ch.SubTitle.Caption := 'hallo'; ch.SubTitle.Caption := 'hallo';
ch.SubTitle.Visible := true; ch.SubTitle.Visible := true;
ch.YAxis.ShowMajorGridLines := true; ch.YAxis.MajorGridLines.Style := clsSolid;
ch.YAxis.ShowMinorGridLines := true; ch.YAxis.MinorGridLines.Style := clsSolid;
// 2nd sheet // 2nd sheet
sh2 := b.AddWorksheet('test2'); sh2 := b.AddWorksheet('test2');
@ -84,8 +99,10 @@ begin
ch.Title.Visible := true; ch.Title.Visible := true;
ch.SubTitle.Caption := 'hallo'; ch.SubTitle.Caption := 'hallo';
ch.Subtitle.Visible := true; ch.Subtitle.Visible := true;
ch.XAxis.ShowMajorGridLines := true; ch.XAxis.MajorGridLines.Style := clsNoLine;
ch.XAxis.ShowMinorGridLines := true; ch.XAxis.MinorGridLines.Style := clsNoLine;
ch.YAxis.MajorGridLines.Style := clsNoLine;
ch.YAxis.MinorGridLines.Style := clsNoLine;
b.WriteToFile('test.xlsx', true); // Excel fails to open the file b.WriteToFile('test.xlsx', true); // Excel fails to open the file
b.WriteToFile('test.ods', true); b.WriteToFile('test.ods', true);

View File

@ -27,36 +27,17 @@ var
type type
TsChart = class; TsChart = class;
TsChartLineRec = record
Style: Integer; // index into chart's LineStyle list or predefined clsSolid/clsNoLine
Width: Double; // mm
Color: TsColor; // in hex: $00bbggrr, r=red, g=green, b=blue
Transparency: Double; // in percent
class operator = (A, B: TsChartLineRec): Boolean;
end;
TsChartLine = class TsChartLine = class
Style: Integer; // index into chart's LineStyle list or predefined clsSolid/clsNoLine Style: Integer; // index into chart's LineStyle list or predefined clsSolid/clsNoLine
Width: Double; // mm Width: Double; // mm
Color: TsColor; // in hex: $00bbggrr, r=red, g=green, b=blue Color: TsColor; // in hex: $00bbggrr, r=red, g=green, b=blue
Transparency: Double; // in percent Transparency: Double; // in percent
procedure FromRecord(const ALine: TsChartLineRec);
function ToRecord: TsChartLineRec;
end;
TsChartFillRec = record
Style: TsFillStyle;
FgColor: TsColor;
BgColor: TsColor;
class operator = (A, B: TsChartFillRec): Boolean;
end; end;
TsChartFill = class TsChartFill = class
Style: TsFillStyle; Style: TsFillStyle;
FgColor: TsColor; FgColor: TsColor;
BgColor: TsColor; BgColor: TsColor;
procedure FromRecord(const AFill: TsChartFillRec);
function ToRecord: TsChartFillRec;
end; end;
TsChartLineSegment = record TsChartLineSegment = record
@ -122,7 +103,7 @@ type
TsChartAxisPosition = (capStart, capEnd, capValue); TsChartAxisPosition = (capStart, capEnd, capValue);
TsChartType = (ctEmpty, ctBar, ctLine, ctArea, ctBarLine, ctScatter); TsChartType = (ctEmpty, ctBar, ctLine, ctArea, ctBarLine, ctScatter);
TsChartAxis = class(TsChartText) TsChartAxis = class(TsChartFillElement)
private private
FAutomaticMax: Boolean; FAutomaticMax: Boolean;
FAutomaticMin: Boolean; FAutomaticMin: Boolean;
@ -132,8 +113,12 @@ type
FMajorGridLines: TsChartLine; FMajorGridLines: TsChartLine;
FMinorGridLines: TsChartline; FMinorGridLines: TsChartline;
FInverted: Boolean; FInverted: Boolean;
FCaption: String;
FCaptionFont: TsFont;
FCaptionRotation: Integer;
FLabelFont: TsFont; FLabelFont: TsFont;
FLabelFormat: String; FLabelFormat: String;
FLabelRotation: Integer;
FLogarithmic: Boolean; FLogarithmic: Boolean;
FMajorInterval: Double; FMajorInterval: Double;
FMajorTickLines: TsChartLine; FMajorTickLines: TsChartLine;
@ -143,34 +128,35 @@ type
FMinorTickLines: TsChartLine; FMinorTickLines: TsChartLine;
FPosition: TsChartAxisPosition; FPosition: TsChartAxisPosition;
FPositionValue: Double; FPositionValue: Double;
FShowMajorGridLines: Boolean; FShowCaption: Boolean;
FShowMinorGridLines: Boolean;
FShowLabels: Boolean; FShowLabels: Boolean;
public public
constructor Create(AChart: TsChart); constructor Create(AChart: TsChart);
destructor Destroy; override; destructor Destroy; override;
property AutomaticMax: Boolean read FAutomaticMax write FAutomaticMax; property AutomaticMax: Boolean read FAutomaticMax write FAutomaticMax;
property AutomaticMin: Boolean read FAutomaticMin write FAutomaticMin; property AutomaticMin: Boolean read FAutomaticMin write FAutomaticMin;
property AutomaticMajorInterval: Boolean read FAutomaticMajorInterval write FAutomaticMajorInterval; property AutomaticMajorInterval: Boolean read FAutomaticMajorInterval write FAutomaticMajorInterval;
property AutomaticMinorSteps: Boolean read FAutomaticMinorSteps write FAutomaticMinorSteps; property AutomaticMinorSteps: Boolean read FAutomaticMinorSteps write FAutomaticMinorSteps;
property AxisLine: TsChartLine read FAxisLine write FAxisLine; property AxisLine: TsChartLine read FAxisLine write FAxisLine;
property Caption: String read FCaption write FCaption;
property CaptionFont: TsFont read FCaptionFont write FCaptionFont;
property CaptionRotation: Integer read FCaptionRotation write FCaptionRotation;
property Inverted: Boolean read FInverted write FInverted; property Inverted: Boolean read FInverted write FInverted;
property LabelFont: TsFont read FLabelFont write FLabelFont; property LabelFont: TsFont read FLabelFont write FLabelFont;
property LabelFormat: String read FLabelFormat write FLabelFormat; property LabelFormat: String read FLabelFormat write FLabelFormat;
property LabelRotation: Integer read FLabelRotation write FLabelRotation;
property Logarithmic: Boolean read FLogarithmic write FLogarithmic; property Logarithmic: Boolean read FLogarithmic write FLogarithmic;
property MajorGridLines: TsChartLine read FMajorGridLines write FMajorGridLines; property MajorGridLines: TsChartLine read FMajorGridLines write FMajorGridLines;
property MajorInterval: Double read FMajorInterval write FMajorInterval; property MajorInterval: Double read FMajorInterval write FMajorInterval;
property MajorTickLines: TsChartLine read FMajorTickLines write FMajorTickLines; property MajorTickLines: TsChartLine read FMajorTickLines write FMajorTickLines;
property Max: Double read FMax write FMax; property Max: Double read FMax write FMax;
property Min: Double read FMin write FMin; property Min: Double read FMin write FMin;
property MinorGrid: TsChartLine read FMinorGridLines write FMinorGridLines; property MinorGridLines: TsChartLine read FMinorGridLines write FMinorGridLines;
property MinorSteps: Double read FMinorSteps write FMinorSteps; property MinorSteps: Double read FMinorSteps write FMinorSteps;
property MinorTickLines: TsChartLine read FMinorTickLines write FMinorTickLines; property MinorTickLines: TsChartLine read FMinorTickLines write FMinorTickLines;
property Position: TsChartAxisPosition read FPosition write FPosition; property Position: TsChartAxisPosition read FPosition write FPosition;
property PositionValue: Double read FPositionValue write FPositionValue; property PositionValue: Double read FPositionValue write FPositionValue;
property ShowMajorGridLines: Boolean read FShowMajorGridLines write FShowMajorGridLines; property ShowCaption: Boolean read FShowCaption write FShowCaption;
property ShowMinorGridLines: Boolean read FShowMinorGridLines write FShowMinorGridLines;
property ShowLabels: Boolean read FShowLabels write FShowLabels; property ShowLabels: Boolean read FShowLabels write FShowLabels;
end; end;
@ -345,52 +331,7 @@ implementation
const const
DEFAULT_LINE_WIDTH = 0.75; // pts DEFAULT_LINE_WIDTH = 0.75; // pts
DEFAULT_FONT = 'Arial';
{ TsChartLineRec }
class operator TsChartLineRec.= (A, B: TsChartLineRec): Boolean;
begin
Result := (A.Style = B.Style) and (A.Width = B.Width) and
(A.Color = B.Color) and (A.Transparency = B.Transparency);
end;
{ TsChartLine }
procedure TsChartLine.FromRecord(const ALine: TsChartLineRec);
begin
Style := ALine.Style;
Width := ALine.Width;
Color := ALine.Color;
Transparency := ALine.Transparency;
end;
function TsChartLine.ToRecord: TsChartLineRec;
begin
Result.Style := Style;
Result.Width := Width;
Result.Color := Color;
Result.Transparency := Transparency;
end;
{ TsChartFillRec }
class operator TsChartFillRec.= (A, B: TsChartFillRec): Boolean;
begin
Result := (A.Style = B.Style) and (A.FgColor = B.FgColor) and (A.BgColor = B.BgColor);
end;
{ TsChartFill }
procedure TsChartFill.FromRecord(const AFill: TsChartFillRec);
begin
Style := AFill.Style;
FgColor := AFill.FgColor;
BgColor := AFill.BgColor;
end;
function TsChartFill.ToRecord: TsChartFillRec;
begin
Result.Style := Style;
Result.BgColor := BgColor;
Result.FgColor := FgColor;
end;
{ TsChartLineStyle } { TsChartLineStyle }
@ -476,8 +417,8 @@ begin
inherited Create(AChart); inherited Create(AChart);
FShowCaption := true; FShowCaption := true;
FFont := TsFont.Create; FFont := TsFont.Create;
FFont.FontName := ''; // replace by workbook's default font FFont.FontName := DEFAULT_FONT;
FFont.Size := 0; // replace by workbook's default font size FFont.Size := 10;
FFont.Style := []; FFont.Style := [];
FFont.Color := scBlack; FFont.Color := scBlack;
end; end;
@ -498,12 +439,22 @@ begin
FAutomaticMajorInterval := true; FAutomaticMajorInterval := true;
FAutomaticMinorSteps := true; FAutomaticMinorSteps := true;
FCaptionFont := TsFont.Create;
FCaptionFont.FontName := DEFAULT_FONT;
FCaptionFont.Size := 10;
FCaptionFont.Style := [];
FCaptionFont.Color := scBlack;
FLabelFont := TsFont.Create; FLabelFont := TsFont.Create;
FLabelFont.FontName := ''; // replace by workbook's default font FLabelFont.FontName := DEFAULT_FONT;
FLabelFont.Size := 0; // Replace by workbook's default font size FLabelFont.Size := 9;
FLabelFont.Style := []; FLabelFont.Style := [];
FLabelFont.Color := scBlack; FLabelFont.Color := scBlack;
FCaptionRotation := 0;
FLabelRotation := 0;
FShowCaption := true;
FShowLabels := true; FShowLabels := true;
FAxisLine := TsChartLine.Create; FAxisLine := TsChartLine.Create;
@ -540,41 +491,10 @@ begin
FMajorTickLines.Free; FMajorTickLines.Free;
FAxisLine.Free; FAxisLine.Free;
FLabelFont.Free; FLabelFont.Free;
FCaptionFont.Free;
inherited; inherited;
end; end;
(*
{ Determines how many labels are provided in the CategoryLabelRange. }
function TsChartAxis.GetCategoryCount: Integer;
begin
if CategoriesInCol then
Result := FLabelRange.Col2 - FLabelRange.Col1 + 1
else
if CategoriesInCol then
Result := FLabelRange.Row2 - FLabelRange.Row1 + 1
else
Result := 0;
end;
{ Returns true when the axis owns its own category labels. Otherwise labels
are taken from the series }
function TsChartAxis.HasCategoryLabels: Boolean;
begin
Result := CategoriesInCol or CategoriesInRow;
end;
{ Determines whether the axis labels are taken from columns (true) or rows (false) }
function TsChartAxis.CategoriesInCol: Boolean;
begin
Result := (FCategoryLabelRange.Row1 <> FCategoryLabelRange.Row2) and
(FCategoryLabelRange.Col1 = FCategoryLabelRange.Col2);
end;
function TsChartAxis.CategoriesInRow: Boolean;
begin
Result := (FCategoryLabelRange.Col1 <> FCategoryLabelRange.Col2) and
(FCategoryLabelRange.Row1 = FCategoryLabelRange.Row2);
end;
*)
{ TsChartSeries } { TsChartSeries }
@ -763,31 +683,29 @@ begin
FXAxis := TsChartAxis.Create(self); FXAxis := TsChartAxis.Create(self);
FXAxis.Caption := 'x axis'; FXAxis.Caption := 'x axis';
FXAxis.CaptionFont.Style := [fssBold];
FXAxis.LabelFont.Size := 9; FXAxis.LabelFont.Size := 9;
FXAxis.Font.Size := 10;
FXAxis.Font.Style := [fssBold];
FXAxis.Position := capStart; FXAxis.Position := capStart;
FX2Axis := TsChartAxis.Create(self); FX2Axis := TsChartAxis.Create(self);
FX2Axis.Caption := 'Secondary x axis'; FX2Axis.Caption := 'Secondary x axis';
FX2Axis.CaptionFont.Style := [fssBold];
FX2Axis.LabelFont.Size := 9; FX2Axis.LabelFont.Size := 9;
FX2Axis.Font.Size := 10;
FX2Axis.Font.Style := [fssBold];
FX2Axis.Visible := false; FX2Axis.Visible := false;
FX2Axis.Position := capEnd; FX2Axis.Position := capEnd;
FYAxis := TsChartAxis.Create(self); FYAxis := TsChartAxis.Create(self);
FYAxis.Caption := 'y axis'; FYAxis.Caption := 'y axis';
FYAxis.CaptionFont.Style := [fssBold];
FYAxis.CaptionRotation := 90;
FYAxis.LabelFont.Size := 9; FYAxis.LabelFont.Size := 9;
FYAxis.Font.Size := 10;
FYAxis.Font.Style := [fssBold];
FYAxis.Position := capStart; FYAxis.Position := capStart;
FY2Axis := TsChartAxis.Create(self); FY2Axis := TsChartAxis.Create(self);
FY2Axis.Caption := 'Secondary y axis'; FY2Axis.Caption := 'Secondary y axis';
FY2Axis.CaptionFont.Style := [fssBold];
FY2Axis.CaptionRotation := 90;
FY2Axis.LabelFont.Size := 9; FY2Axis.LabelFont.Size := 9;
FY2Axis.Font.Size := 10;
FY2Axis.Font.Style := [fssBold];
FY2Axis.Visible := false; FY2Axis.Visible := false;
FY2Axis.Position := capEnd; FY2Axis.Position := capEnd;

View File

@ -1,6 +1,7 @@
unit fpsChartStyles; unit fpsChartStyles;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{$modeswitch advancedrecords}
interface interface
@ -8,92 +9,474 @@ uses
Classes, SysUtils, fpsTypes, fpsChart; Classes, SysUtils, fpsTypes, fpsChart;
type type
TsChartStyleType = (cstBackground, cstWall, cstFloor); TsChartBackgroundType = (cbtBackground, cbtWall, cbtFloor);
TsChartAxisType = (catPrimaryX, catPrimaryY, catSecondaryX, catSecondaryY);
TsChartCaptionType = (cctTitle, cctSubtitle,
cctPrimaryX, cctPrimaryY, cctSecondaryX, cctSecondaryY);
TsChartLineRec = record
Style: Integer; // index into chart's LineStyle list or predefined clsSolid/clsNoLine
Width: Double; // mm
Color: TsColor; // in hex: $00bbggrr, r=red, g=green, b=blue
Transparency: Double; // in percent
procedure FromLine(ALine: TsChartline);
procedure ToLine(ALine: TsChartLine);
class operator = (A, B: TsChartLineRec): Boolean;
end;
TsChartFillRec = record
Style: TsFillStyle;
FgColor: TsColor;
BgColor: TsColor;
procedure FromFill(AFill: TsChartFill);
procedure ToFill(AFill: TsChartFill);
class operator = (A, B: TsChartFillRec): Boolean;
end;
TsChartFontRec = record
FontName: String;
Size: Double;
Style: TsFontStyles;
Color: TsColor;
Position: TsFontPosition;
procedure FromFont(AFont: TsFont);
procedure ToFont(AFont: TsFont);
class operator = (A, B: TsChartFontRec): Boolean;
end;
TsChartAxisRec = record
AutomaticMax: Boolean;
AutomaticMin: Boolean;
AutomaticMajorInterval: Boolean;
AutomaticMinorInterval: Boolean;
AxisLine: TsChartLineRec;
MajorGridLines: TsChartLineRec;
MinorGridLines: TsChartLineRec;
MajorTickLines: TsChartLineRec;
MinorTickLines: TsChartLineRec;
Inverted: Boolean;
// CaptionFont: TsChartFontRec;
LabelFont: TsChartFontRec;
LabelFormat: String;
LabelRotation: Integer;
Logarithmic: Boolean;
MajorInterval: Double;
MinorInterval: Double;
Position: TsChartAxisPosition;
// ShowCaption: Boolean;
ShowLabels: Boolean;
Visible: Boolean;
procedure FromAxis(Axis: TsChartAxis);
procedure ToAxis(Axis: TsChartAxis);
class operator = (A, B: TsChartAxisRec): Boolean;
end;
TsChartCaptionRec = record
Font: TsChartFontRec;
Rotation: Integer;
Visible: Boolean;
procedure FromChart(AChart: TsChart; AType: TsChartCaptionType);
procedure ToChart(AChart: TsChart; AType: TsChartCaptionType);
class operator = (A, B: TsChartCaptionRec): Boolean;
end;
{----------------------------------------------------------------------------}
TsChartStyle = class TsChartStyle = class
private
FStyleType: TsChartStyleType;
public public
constructor Create(AStyleType: TsChartStyleType); virtual;
procedure ApplyToChart(AChart: TsChart); virtual; abstract; procedure ApplyToChart(AChart: TsChart); virtual; abstract;
procedure ExtractFromChart(AChart: TsChart); virtual; abstract; procedure ExtractFromChart(AChart: TsChart); virtual; abstract;
property StyleType: TsChartStyleType read FStyleType;
end; end;
TsChartBackgroundStyle = class(TsChartStyle) TsChartBackgroundStyle = class(TsChartStyle)
private private
FBackgroundType: TsChartBackgroundType;
FBackground: TsChartFillRec; FBackground: TsChartFillRec;
FBorder: TsChartLineRec; FBorder: TsChartLineRec;
public public
constructor Create(AType: TsChartBackgroundType);
procedure ApplyToChart(AChart: TsChart); override; procedure ApplyToChart(AChart: TsChart); override;
procedure ExtractFromChart(AChart: TsChart); override; procedure ExtractFromChart(AChart: TsChart); override;
property BackgroundType: TsChartBackgroundType read FBackgroundType write FBackgroundType;
property Background: TsChartFillRec read FBackground; property Background: TsChartFillRec read FBackground;
property Border: TsChartLineRec read FBorder; property Border: TsChartLineRec read FBorder;
end; end;
TsChartAxisStyle = class(TsChartStyle)
private
FAxis: TsChartAxisRec;
FAxisType: TsChartAxisType;
public
constructor Create(AType: TsChartAxisType);
procedure ApplyToChart(AChart: TsChart); override;
procedure ExtractFromChart(AChart: TsChart); override;
property Axis: TsChartAxisRec read FAxis write FAxis;
property AxisType: TsChartAxisType read FAxisType write FAxisType;
end;
TsChartCaptionStyle = class(TsChartStyle)
private
FCaption: TsChartCaptionRec;
FCaptionType: TsChartCaptionType;
public
constructor Create(AType: TsChartCaptionType);
procedure ApplyToChart(AChart: TsChart); override;
procedure ExtractFromChart(AChart: TsChart); override;
property Caption: TsChartCaptionRec read FCaption write FCaption;
property CaptionType: TsChartCaptionType read FCaptionType write FCaptionType;
end;
{ ---------------------------------------------------------------------------}
TsChartStyleList = class(TFPList) TsChartStyleList = class(TFPList)
protected protected
public public
destructor Destroy; override; destructor Destroy; override;
procedure AddChartBackgroundStyle(AChart: TsChart; AStyleType: TsChartStyleType); procedure AddChartAxisStyle(AChart: TsChart; AType: TsChartAxisType);
procedure AddChartBackgroundStyle(AChart: TsChart; AType: TsChartBackgroundType);
procedure AddChartCaptionStyle(AChart: TsChart; AType: TsChartCaptionType);
procedure Clear; procedure Clear;
function FindChartBackgroundStyle(AChart: TsChart; AStyleType: TsChartStyleType): Integer; function FindChartAxisStyle(AChart: TsChart; AType: TsChartAxisType): Integer;
function FindChartBackgroundStyle(AChart: TsChart; AType: TsChartBackgroundType): Integer;
function FindChartCaptionStyle(AChart: TsChart; AType: TsChartCaptionType): Integer;
end; end;
implementation implementation
{ TsChartStyle } {==============================================================================}
{ Style records }
{==============================================================================}
constructor TsChartStyle.Create(AStyleType: TsChartStyleType); { TsFontRec }
procedure TsChartFontRec.FromFont(AFont: TsFont);
begin begin
FStyleType := AStyleType; FontName := AFont.FontName;
Size := AFont.Size;
Style := AFont.Style;
Color := AFont.Color;
Position := AFont.Position;
end; end;
procedure TsChartFontRec.ToFont(AFont: TsFont);
begin
AFont.FontName := FontName;
AFont.Size := Size;
AFont.Style := Style;
AFont.Color := Color;
AFont.Position := Position;
end;
class operator TsChartFontRec.= (A, B: TsChartFontRec): Boolean;
begin
Result := (A.FontName = B.FontName) and (A.Size = B.Size) and
(A.Style = B.Style) and (A.Color = B.Color) and
(A.Position = B.Position);
end;
{ TsChartLineRec }
procedure TsChartLineRec.FromLine(ALine: TsChartLine);
begin
Style := ALine.Style;
Width := ALine.Width;
Color := ALine.Color;
Transparency := ALine.Transparency;
end;
procedure TsChartLineRec.ToLine(ALine: TsChartLine);
begin
ALine.Style := Style;
ALine.Width := Width;
ALine.Color := Color;
ALine.Transparency := Transparency;
end;
class operator TsChartLineRec.= (A, B: TsChartLineRec): Boolean;
begin
Result := (A.Style = B.Style) and (A.Width = B.Width) and
(A.Color = B.Color) and (A.Transparency = B.Transparency);
end;
{ TsChartFillRec }
procedure TsChartFillRec.FromFill(AFill: TsChartFill);
begin
Style := AFill.Style;
FgColor := AFill.FgColor;
BgColor := AFill.BgColor;
end;
procedure TsChartFillRec.ToFill(AFill: TsChartFill);
begin
AFill.Style := Style;
AFill.FgColor := FgColor;
AFill.BgColor := BgColor;
end;
class operator TsChartFillRec.= (A, B: TsChartFillRec): Boolean;
begin
Result := (A.Style = B.Style) and (A.FgColor = B.FgColor) and (A.BgColor = B.BgColor);
end;
{ TsChartAxisRec }
procedure TsChartAxisRec.FromAxis(Axis: TsChartAxis);
begin
AutomaticMax := Axis.AutomaticMax;
AutomaticMin := Axis.AutomaticMin;
AutomaticMajorInterval := Axis.AutomaticMajorInterval;
AutomaticMinorInterval := Axis.AutomaticMinorSteps;
AxisLine.FromLine(Axis.AxisLine);
MajorGridLines.FromLine(Axis.MajorGridLines);
MinorGridLines.FromLine(Axis.MinorGridLines);
MajorTickLines.FromLine(Axis.MajorTickLines);
MinorTickLines.FromLine(Axis.MinorTickLines);
Inverted := Axis.Inverted;
// CaptionFont.FromFont(Axis.Font);
LabelFont.FromFont(Axis.LabelFont);
LabelFormat := Axis.LabelFormat;
LabelRotation := Axis.LabelRotation;
Logarithmic := Axis.Logarithmic;
MajorInterval := Axis.MajorInterval;
MinorInterval := Axis.MinorSteps;
Position := Axis.Position;
// ShowCaption := Axis.ShowCaption;
ShowLabels := Axis.ShowLabels;
Visible := Axis.Visible;
end;
procedure TsChartAxisRec.ToAxis(Axis: TsChartAxis);
begin
Axis.AutomaticMax := AutomaticMax;
Axis.AutomaticMin := AutomaticMin;
Axis.AutomaticMajorInterval := AutomaticMajorInterval;
Axis.AutomaticMinorSteps := AutomaticMinorInterval;
AxisLine.ToLine(Axis.AxisLine);
MajorGridLines.ToLine(Axis.MajorGridLines);
MinorGridLines.ToLine(Axis.MinorGridLines);
MajorTickLines.ToLine(Axis.MajorTickLines);
MinorTickLines.ToLine(Axis.MinorTickLines);
Axis.Inverted := Inverted;
// CaptionFont.ToFont(Axis.Font);
LabelFont.ToFont(Axis.LabelFont);
Axis.LabelFormat := LabelFormat;
Axis.LabelRotation := LabelRotation;
Axis.Logarithmic := Logarithmic;
Axis.MajorInterval := MajorInterval;
Axis.MinorSteps := MinorInterval;
Axis.Position := Position;
// Axis.ShowCaption := ShowCaption;
Axis.Visible := Visible;
Axis.ShowLabels := ShowLabels;
end;
class operator TsChartAxisRec.= (A, B: TsChartAxisRec): Boolean;
begin
Result := (A.AutomaticMax = B.AutomaticMax) and (A.AutomaticMin = B.AutomaticMin) and
(A.AutomaticMajorInterval = B.AutomaticMajorInterval) and
(A.AutomaticMinorInterval = B.AutomaticMinorInterval) and
(A.AxisLine = B.AxisLine) and
(A.MajorGridLines = B.MajorGridLines) and
(A.MinorGridLines = B.MinorGridLines) and
(A.MajorTickLines = B.MajorTickLines) and
(A.MinorTickLines = B.MinorTickLines) and
(A.Inverted = B.Inverted) and
// (A.CaptionFont = B.CaptionFont) and
(A.LabelFont = B.LabelFont) and
(A.LabelFormat = B.LabelFormat) and
(A.LabelRotation = B.LabelRotation) and
(A.Logarithmic = B.Logarithmic) and
(A.MajorInterval = B.MajorInterval) and
(A.MinorInterval = B.MinorInterval) and
(A.Position = B.Position) and
// (A.ShowCaption = B.ShowCaption) and
(A.ShowLabels = B.ShowLabels) and
(A.Visible = B.Visible);
end;
{ TsChartCaptionRec }
procedure TsChartCaptionRec.FromChart(AChart: TsChart; AType: TsChartCaptionType);
begin
case AType of
cctTitle:
begin
Font.FromFont(AChart.Title.Font);
Visible := AChart.Title.ShowCaption;
end;
cctSubtitle:
begin
Font.FromFont(AChart.Subtitle.Font);
Visible := AChart.Subtitle.ShowCaption;
end;
cctPrimaryX:
begin
Font.FromFont(AChart.XAxis.CaptionFont);
Visible := AChart.XAxis.ShowCaption;
end;
cctPrimaryY:
begin
Font.FromFont(AChart.YAxis.CaptionFont);
Visible := AChart.YAxis.ShowCaption;
end;
cctSecondaryX:
begin
Font.FromFont(AChart.X2Axis.CaptionFont);
Visible := AChart.X2Axis.ShowCaption;
end;
cctSecondaryY:
begin
Font.FromFont(AChart.Y2Axis.CaptionFont);
Visible := AChart.Y2Axis.ShowCaption;
end;
end;
end;
procedure TsChartCaptionRec.ToChart(AChart: TsChart; AType: TsChartCaptionType);
begin
case AType of
cctTitle:
begin
Font.ToFont(AChart.Title.Font);
AChart.Title.ShowCaption := Visible;
end;
cctSubtitle:
begin
Font.ToFont(AChart.Subtitle.Font);
AChart.Subtitle.ShowCaption := Visible;
end;
cctPrimaryX:
begin
Font.ToFont(AChart.XAxis.CaptionFont);
AChart.XAxis.ShowCaption := Visible;
end;
cctPrimaryY:
begin
Font.ToFont(AChart.YAxis.CaptionFont);
AChart.YAxis.ShowCaption := Visible;
end;
cctSecondaryX:
begin
Font.ToFont(AChart.X2Axis.CaptionFont);
AChart.X2Axis.ShowCaption := Visible;
end;
cctSecondaryY:
begin
Font.ToFont(AChart.Y2Axis.CaptionFont);
AChart.Y2Axis.ShowCaption := Visible;
end;
end;
end;
class operator TsChartCaptionRec.= (A, B: TsChartCaptionRec): Boolean;
begin
Result := (A.Font = B.Font) and (A.Visible = B.Visible);
end;
{ TsChartBackgroundstyle } { TsChartBackgroundstyle }
constructor TsChartBackgroundStyle.Create(AType: TsChartBackgroundType);
begin
inherited Create;
FBackgroundType := AType;
end;
procedure TsChartBackgroundStyle.ApplyToChart(AChart: TsChart); procedure TsChartBackgroundStyle.ApplyToChart(AChart: TsChart);
begin begin
case FStyleType of case FBackgroundType of
cstBackground: cbtBackground:
begin begin
AChart.Background.FromRecord(FBackground); FBackground.ToFill(AChart.Background);
AChart.Border.FromRecord(FBorder); FBorder.ToLine(AChart.Border);
end; end;
cstWall: cbtWall:
begin begin
AChart.PlotArea.Background.FromRecord(FBackground); FBackground.ToFill(AChart.PlotArea.Background);
AChart.PlotArea.Border.FromRecord(FBorder); FBorder.ToLine(AChart.PlotArea.Border);
end; end;
cstFloor: cbtFloor:
begin begin
AChart.Floor.Background.FromRecord(FBackGround); FBackground.ToFill(AChart.Floor.Background);
AChart.Floor.Border.FromRecord(FBorder); FBorder.ToLine(AChart.Floor.Border);
end; end;
else
raise Exception.Create('Unknown background style.');
end; end;
end; end;
procedure TsChartBackgroundStyle.ExtractFromChart(AChart: TsChart); procedure TsChartBackgroundStyle.ExtractFromChart(AChart: TsChart);
begin begin
case FStyleType of case FBackgroundType of
cstBackground: cbtBackground:
begin begin
FBackground := AChart.Background.ToRecord; FBackground.FromFill(AChart.Background);
FBorder := AChart.Border.ToRecord; FBorder.FromLine(AChart.Border);
end; end;
cstWall: cbtWall:
begin begin
FBackground := AChart.PlotArea.Background.ToRecord; FBackground.FromFill(AChart.PlotArea.Background);
FBorder := AChart.PlotArea.Border.ToRecord; FBorder.FromLine(AChart.PlotArea.Border);
end; end;
cstFloor: cbtFloor:
begin begin
FBackground := AChart.Floor.Background.ToRecord; FBackground.FromFill(AChart.Floor.Background);
FBorder := AChart.Floor.Border.ToRecord; FBorder.FromLine(AChart.Floor.Border);
end; end;
end; end;
end; end;
{ TsChartAxisStyle }
constructor TsChartAxisStyle.Create(AType: TsChartAxisType);
begin
inherited Create;
FAxisType := AType;
end;
procedure TsChartAxisStyle.ApplyToChart(AChart: TsChart);
begin
case FAxisType of
catPrimaryX: Axis.ToAxis(AChart.XAxis);
catPrimaryY: Axis.ToAxis(AChart.YAxis);
catSecondaryX: Axis.ToAxis(AChart.X2Axis);
catSecondaryY: Axis.ToAxis(AChart.Y2Axis);
end;
end;
procedure TsChartAxisStyle.ExtractFromChart(AChart: TsChart);
begin
case FAxisType of
catPrimaryX: Axis.FromAxis(AChart.XAxis);
catPrimaryY: Axis.FromAxis(AChart.YAxis);
catSecondaryX: Axis.FromAxis(AChart.X2Axis);
catSecondaryY: Axis.FromAxis(AChart.Y2Axis);
end;
end;
{ TsChartCaptionStyle }
constructor TsChartCaptionStyle.Create(AType: TsChartCaptionType);
begin
inherited Create;
FCaptionType := AType;
end;
procedure TsChartCaptionStyle.ApplyToChart(AChart: TsChart);
begin
Caption.ToChart(AChart, FCaptionType);
end;
procedure TsChartCaptionStyle.ExtractFromChart(AChart: TsChart);
begin
Caption.FromChart(AChart, FCaptionType);
end;
{ TsChartStyleList } { TsChartStyleList }
destructor TsChartStyleList.Destroy; destructor TsChartStyleList.Destroy;
@ -102,12 +485,28 @@ begin
inherited; inherited;
end; end;
{ Adds the style of the specified axis type in the given chart as new style to
the style list. But only if the same style does not yet exist. }
procedure TsChartStyleList.AddChartAxisStyle(AChart: TsChart;
AType: TsChartAxisType);
begin
FindChartAxisStyle(AChart, AType);
end;
{ Adds the style of the specified caption in the given chart as new style to
the style list. But only if the same style does not yet exist. }
procedure TsChartStyleList.AddChartCaptionStyle(AChart: TsChart;
AType: TsChartCaptionType);
begin
FindChartCaptionStyle(AChart, AType);
end;
{ Adds the style of the specified type in the given chart as new style to the { Adds the style of the specified type in the given chart as new style to the
style list. But only if the same style does not yet exist. } style list. But only if the same style does not yet exist. }
procedure TsChartStyleList.AddChartBackgroundStyle(AChart: TsChart; procedure TsChartStyleList.AddChartBackgroundStyle(AChart: TsChart;
AStyleType: TsChartStyleType); AType: TsChartBackgroundType);
begin begin
FindChartBackgroundStyle(AChart, AStyleType); FindChartBackgroundStyle(AChart, AType);
end; end;
procedure TsChartStyleList.Clear; procedure TsChartStyleList.Clear;
@ -119,26 +518,25 @@ begin
inherited Clear; inherited Clear;
end; end;
{ Searches whether the background style of the specified chart is already in the { Searches whether the style of the specified axis is already in the
list. If not, a new style is created and added. list. If not, a new style is created and added.
The type of the requested background must be provided as parameter. The type of the requested axis must be provided as parameter.
Returns the index of the style. } Returns the index of the style. }
function TsChartStyleList.FindChartBackgroundStyle(AChart: TsChart; function TsChartStyleList.FindChartAxisStyle(AChart: TsChart;
AStyleType: TsChartStyleType): Integer; AType: TsChartAxisType): Integer;
var var
newStyle, style: TsChartBackgroundStyle; newStyle, style: TsChartAxisStyle;
i: Integer; i: Integer;
begin begin
Result := -1; Result := -1;
newStyle := TsChartBackgroundStyle.Create(AStyleType); newStyle := TsChartAxisStyle.Create(AType);
newStyle.ExtractFromChart(AChart); newStyle.ExtractFromChart(AChart);
for i := 0 to Count-1 do for i := 0 to Count-1 do
begin begin
if (TsChartStyle(Items[i]) is TsChartBackgroundStyle) and if (TsChartStyle(Items[i]) is TsChartAxisStyle) then
(TsChartStyle(Items[i]).StyleType = AStyleType) then
begin begin
style := TsChartBackgroundStyle(Items[i]); style := TsChartAxisStyle(Items[i]);
if (style.Background = newStyle.Background) then if (style.AxisType = AType) and (style.Axis = newStyle.Axis) then
begin begin
Result := i; Result := i;
break; break;
@ -151,5 +549,68 @@ begin
newStyle.Free; newStyle.Free;
end; end;
{ Searches whether the background style of the specified chart is already in the
list. If not, a new style is created and added.
The type of the requested background must be provided as parameter.
Returns the index of the style. }
function TsChartStyleList.FindChartBackgroundStyle(AChart: TsChart;
AType: TsChartBackgroundType): Integer;
var
newStyle, style: TsChartBackgroundStyle;
i: Integer;
begin
Result := -1;
newStyle := TsChartBackgroundStyle.Create(AType);
newStyle.ExtractFromChart(AChart);
for i := 0 to Count-1 do
begin
if (TsChartStyle(Items[i]) is TsChartBackgroundStyle) then
begin
style := TsChartBackgroundStyle(Items[i]);
if (style.BackgroundType = AType) and (style.Background = newStyle.Background) then
begin
Result := i;
break;
end;
end;
end;
if Result = -1 then
Result := Add(newStyle)
else
newStyle.Free;
end;
{ Searches whether the style of the specified caption is already in the
list. If not, a new style is created and added.
The type of the requested axis must be provided as parameter.
Returns the index of the style. }
function TsChartStyleList.FindChartCaptionStyle(AChart: TsChart;
AType: TsChartCaptionType): Integer;
var
newStyle, style: TsChartCaptionStyle;
i: Integer;
begin
Result := -1;
newStyle := TsChartCaptionStyle.Create(AType);
newStyle.ExtractFromChart(AChart);
for i := 0 to Count-1 do
begin
if (TsChartStyle(Items[i]) is TsChartCaptionStyle) then
begin
style := TsChartCaptionStyle(Items[i]);
if {(style.AxisType = AType) and} (style.Caption = newStyle.Caption) then
begin
Result := i;
break;
end;
end;
end;
if Result = -1 then
Result := Add(newStyle)
else
newStyle.Free;
end;
end. end.

View File

@ -286,7 +286,9 @@ type
function WriteWordwrapStyleXMLAsString(const AFormat: TsCellFormat): String; function WriteWordwrapStyleXMLAsString(const AFormat: TsCellFormat): String;
{ Chart support } { Chart support }
function GetChartAxisStyleAsXML(AChart: TsChart; AStyleIndex: Integer; AIndent: Integer): String;
function GetChartBackgroundStyleAsXML(AChart: TsChart; AStyleIndex: Integer; AIndent: Integer): String; function GetChartBackgroundStyleAsXML(AChart: TsChart; AStyleIndex: Integer; AIndent: Integer): String;
function GetChartCaptionStyleAsXML(AChart: TsChart; AStyleIndex: Integer; AIndent: Integer): String;
procedure PrepareChartTable(AChart: TsChart; AWorksheet: TsBasicWorksheet); procedure PrepareChartTable(AChart: TsChart; AWorksheet: TsBasicWorksheet);
procedure WriteChart(AStream: TStream; AChart: TsChart); procedure WriteChart(AStream: TStream; AChart: TsChart);
@ -5887,9 +5889,22 @@ begin
for i := 0 to book.GetChartCount-1 do for i := 0 to book.GetChartCount-1 do
begin begin
chart := book.GetChartByIndex(i); chart := book.GetChartByIndex(i);
styles.AddChartBackGroundStyle(chart, cstBackground);
styles.AddChartBackgroundStyle(chart, cstWall); styles.AddChartBackGroundStyle(chart, cbtBackground);
styles.AddChartBackgroundStyle(chart, cstFloor); styles.AddChartBackgroundStyle(chart, cbtWall);
styles.AddChartBackgroundStyle(chart, cbtFloor);
styles.AddChartAxisStyle(chart, catPrimaryX);
styles.AddChartAxisStyle(chart, catPrimaryY);
styles.AddChartAxisStyle(chart, catSecondaryX);
styles.AddChartAxisStyle(chart, catSecondaryY);
styles.AddChartCaptionStyle(chart, cctPrimaryX);
styles.AddChartCaptionStyle(chart, cctPrimaryY);
styles.AddChartCaptionStyle(chart, cctSecondaryX);
styles.AddChartCaptionStyle(chart, cctSecondaryY);
styles.AddChartCaptionStyle(chart, cctTitle);
styles.AddChartCaptionStyle(chart, cctSubTitle);
end; end;
end; end;
@ -6778,44 +6793,55 @@ var
axis: TsChartAxis; axis: TsChartAxis;
series: TsChartSeries; series: TsChartSeries;
sheet: TsWorksheet; sheet: TsWorksheet;
styles: TsChartStyleList;
refStr: String; refStr: String;
styleID, titleStyleID: Integer; styleIdx, titleStyleIdx: Integer;
majorGridStyleID: Integer = 8; // styleID, titleStyleID: Integer;
minorGridstyleID: Integer = 9; majorGridStyleID: Integer = 800;
minorGridstyleID: Integer = 900;
r1, c1, r2, c2: Cardinal; r1, c1, r2, c2: Cardinal;
begin begin
ind := DupeString(' ', AIndent); ind := DupeString(' ', AIndent);
sheet := TsWorkbook(FWorkbook).GetWorksheetByIndex(AChart.SheetIndex); sheet := TsWorkbook(FWorkbook).GetWorksheetByIndex(AChart.SheetIndex);
styles := TsChartStyleList(FChartStyleList);
if IsX then if IsX then
begin begin
if IsPrimary then if IsPrimary then
begin begin
axis := AChart.XAxis; axis := AChart.XAxis;
styleID := 6; styleIdx := styles.FindChartAxisStyle(AChart, catPrimaryX);
titleStyleIdx := styles.FindChartCaptionStyle(AChart, cctPrimaryX);
//styleID := 6;
end else end else
begin begin
axis := AChart.X2Axis; axis := AChart.X2Axis;
styleID := 10; styleIdx := styles.FindChartAxisStyle(AChart, catSecondaryX);
titleStyleIdx := styles.FindChartCaptionStyle(AChart, cctSecondaryX);
//styleID := 10;
end; end;
titleStyleID := 7; //titleStyleID := 7;
end else end else
begin begin
if IsPrimary then if IsPrimary then
begin begin
axis := AChart.YAxis; axis := AChart.YAxis;
styleID := 11; styleIdx := styles.FindChartAxisStyle(AChart, catPrimaryY);
titleStyleIdx := styles.FindChartCaptionStyle(AChart, cctPrimaryY);
//styleID := 11;
end else end else
begin begin
axis := AChart.Y2Axis; axis := AChart.Y2Axis;
styleID := 12; styleIdx := styles.FindChartAxisStyle(AChart, catSecondaryY);
titleStyleIdx := styles.FindChartCaptionStyle(AChart, cctSecondaryY);
//styleID := 12;
end; end;
titleStyleID := 12; //titleStyleID := 12;
end; end;
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
ind + '<chart:axis chart:dimension="%s" chart:name="%s-%s" chart:style-name="ch%d" chartooo:axis-type="auto">' + LE, ind + '<chart:axis chart:dimension="%s" chart:name="%s-%s" chart:style-name="ch%d" chartooo:axis-type="auto">' + LE,
[ AXIS_ID[IsX], AXIS_LEVEL[IsPrimary], AXIS_ID[IsX], styleID ] [ AXIS_ID[IsX], AXIS_LEVEL[IsPrimary], AXIS_ID[IsX], styleIdx + 1 ]
)); ));
if IsX and (not AChart.IsScatterChart) and (AChart.Series.Count > 0) then if IsX and (not AChart.IsScatterChart) and (AChart.Series.Count > 0) then
@ -6832,21 +6858,21 @@ begin
)); ));
end; end;
if axis.Caption <> '' then if axis.ShowCaption and (axis.Caption <> '') then
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
ind + ' <chart:title chart:style-name="ch%d">' + LE + ind + ' <chart:title chart:style-name="ch%d">' + LE +
ind + ' <text:p>%s</text:p>' + LE + ind + ' <text:p>%s</text:p>' + LE +
ind + ' </chart:title>' + LE, ind + ' </chart:title>' + LE,
[ titleStyleID, axis.Caption ] [ titleStyleIdx + 1, axis.Caption ]
)); ));
if axis.ShowMajorGridLines then if axis.MajorGridLines.Style <> clsNoLine then
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
ind + ' <chart:grid chart:style-name="ch%d" chart:class="major"/>' + LE, ind + ' <chart:grid chart:style-name="ch%d" chart:class="major"/>' + LE,
[ majorGridStyleID ] [ majorGridStyleID ]
)); ));
if axis.ShowMinorGridLines then if axis.MinorGridLines.Style <> clsNoLine then
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
ind + ' <chart:grid chart:style-name="ch%d" chart:class="minor"/>' + LE, ind + ' <chart:grid chart:style-name="ch%d" chart:class="minor"/>' + LE,
[ minorGridStyleID ] [ minorGridStyleID ]
@ -6869,7 +6895,7 @@ begin
if chartClass <> '' then if chartClass <> '' then
chartClass := ' chart:class="chart:' + chartClass + '"'; chartClass := ' chart:class="chart:' + chartClass + '"';
idx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cstBackground); idx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cbtBackground);
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
' <chart:chart svg:width="%.3fmm" svg:height="%.3fmm" xlink:href=".." ' + LE + ' <chart:chart svg:width="%.3fmm" svg:height="%.3fmm" xlink:href=".." ' + LE +
@ -6887,7 +6913,7 @@ procedure TsSpreadOpenDocWriter.WriteChartLegend(AStream: TStream; AChart: TsCha
AIndent: Integer); AIndent: Integer);
var var
ind: String; ind: String;
legendStyleID: Integer = 4; legendStyleID: Integer = 400;
begin begin
if (not AChart.Legend.Visible) then if (not AChart.Legend.Visible) then
exit; exit;
@ -6906,7 +6932,7 @@ procedure TsSpreadOpenDocWriter.WriteChartPlotArea(AStream: TStream;
var var
ind: String; ind: String;
i: Integer; i: Integer;
plotAreaStyleID: Integer = 5; plotAreaStyleID: Integer = 500;
wallStyleIdx, floorStyleIdx: Integer; wallStyleIdx, floorStyleIdx: Integer;
begin begin
ind := DupeString(' ', AIndent); ind := DupeString(' ', AIndent);
@ -6922,8 +6948,8 @@ begin
for i := 0 to AChart.Series.Count-1 do for i := 0 to AChart.Series.Count-1 do
WriteChartSeries(AStream, AChart, i, AIndent + 2); WriteChartSeries(AStream, AChart, i, AIndent + 2);
wallStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cstWall); wallStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cbtWall);
floorStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cstFloor); floorStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cbtFloor);
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
ind + ' <chart:wall chart:style-name="ch%d"/>' + LE + ind + ' <chart:wall chart:style-name="ch%d"/>' + LE +
@ -6962,7 +6988,7 @@ begin
rfAllRel, false); rfAllRel, false);
count := series.YRange.Row2 - series.YRange.Row1 + 1; count := series.YRange.Row2 - series.YRange.Row1 + 1;
seriesStyleID := 14 + ASeriesIndex; seriesStyleID := (14 + ASeriesIndex) * 100;
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
ind + '<chart:series chart:style-name="ch%d" ' + ind + '<chart:series chart:style-name="ch%d" ' +
@ -6980,6 +7006,81 @@ begin
); );
end; end;
function TsSpreadOpenDocWriter.GetChartAxisStyleAsXML(
AChart: TsChart; AStyleIndex: Integer; AIndent: Integer): String;
var
ind: String;
style: TsChartAxisStyle;
displayLabels: string = '';
logarithmic: String = '';
strokeColor: String = '';
styleRotationAngle: String = '';
fontSize: String = '';
fontColor: String = '';
begin
if AStyleIndex = -1 then
begin
Result := '';
exit;
end;
style := TsChartAxisStyle(FChartStyleList[AStyleIndex]);
if not style.Axis.Visible then
exit;
if style.Axis.ShowLabels then
displayLabels := 'chart:display-label="true" '
else
displayLabels := '';
if style.Axis.Logarithmic then
logarithmic := 'logarithmic="true" '
else
logarithmic := '';
if style.Axis.LabelRotation <> 0 then
styleRotationAngle := 'style:rotation-ange="' + IntToStr(style.Axis.LabelRotation) + '" ';
strokeColor := 'svg:stroke-color="' + ColorToHTMLColorStr(style.Axis.AxisLine.Color) + '" ';
fontSize := Format('fo:font-size="%.1fpt" style:font-size-asian="%.1fpt" style:font-size-complex="%.1fpt" ',
[style.Axis.LabelFont.Size, style.Axis.LabelFont.Size, style.Axis.LabelFont.Size],
FPointSeparatorSettings
);
fontColor := 'fo:color="' + ColorToHTMLColorStr(style.Axis.LabelFont.Color) + '" ';
(*
<style:style style:name="ch10" style:family="chart"
style:data-style-name="N0">
<style:chart-properties chart:display-label="true"
chart:logarithmic="false"
chart:minimum="-2" chart:maximum="2" chart:interval-major="1"
chart:interval-minor-divisor="4" chart:reverse-direction="false"
text:line-break="false" loext:try-staggering-first="false"
chart:link-data-style-to-source="true" chart:axis-position="1"/>
<style:graphic-properties svg:stroke-color="#b3b3b3"/>
<style:text-properties fo:font-size="10pt" style:font-size-asian="10pt"
style:font-size-complex="10pt"/>
*)
ind := DupeString(' ', AIndent);
Result := Format(
ind + '<style:style style:name="ch%d" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties %s%s%s/>' + LE +
ind + ' <style:graphic-properties %s/>' + LE +
ind + ' <style:text-properties %s%s/>' + LE +
ind + '</style:style>' + LE,
[ AStyleIndex + 1,
// chart-properties
displayLabels, logarithmic, styleRotationAngle,
// graphic-properties
strokeColor,
// text-properties
fontSize, fontColor
]
);
end;
function TsSpreadOpenDocWriter.GetChartBackgroundStyleAsXML( function TsSpreadOpenDocWriter.GetChartBackgroundStyleAsXML(
AChart: TsChart; AStyleIndex: Integer; AIndent: Integer): String; AChart: TsChart; AStyleIndex: Integer; AIndent: Integer): String;
var var
@ -7018,7 +7119,56 @@ begin
ind + '<style:style style:name="ch%d" style:family="chart">' + LE + ind + '<style:style style:name="ch%d" style:family="chart">' + LE +
ind + ' <style:graphic-properties %s%s%s%s />' + LE + ind + ' <style:graphic-properties %s%s%s%s />' + LE +
ind + '</style:style>' + LE, ind + '</style:style>' + LE,
[ AStyleIndex+1, drawStroke, strokeColor, drawFill, drawFillColor ] [ AStyleIndex+1,
drawStroke, strokeColor, drawFill, drawFillColor ]
);
end;
{
<style:style style:name="ch7" style:family="chart">
<style:chart-properties chart:auto-position="true" style:rotation-angle="0"/>
<style:text-properties fo:font-size="9pt" style:font-size-asian="9pt" style:font-size-complex="9pt"/>
</style:style>
}
function TsSpreadOpenDocWriter.GetChartCaptionStyleAsXML(AChart: TsChart;
AStyleIndex: Integer; AIndent: Integer): String;
var
style: TsChartCaptionStyle;
ind: String;
fontSize: String = '';
fontColor: String = '';
styleRotationAngle: String = '';
begin
Result := '';
if AStyleIndex = -1 then
exit;
style := TsChartCaptionStyle(FChartStyleList[AStyleIndex]);
if not style.Caption.Visible then
exit;
if style.Caption.Rotation <> 0 then
styleRotationAngle := Format('style:rotation-angle="%d" ', [style.Caption.Rotation]);
fontSize := Format('fo:font-size="%.1fpt" style:font-size-asian="%.1fpt" style:font-size-complex="%.1fpt" ',
[ style.Caption.Font.Size, style.Caption.Font.Size, style.Caption.Font.Size ],
FPointSeparatorSettings
);
fontColor := Format('fo:color="%s" ', [ColorToHTMLColorStr(style.Caption.Font.Color)]);
ind := DupeString(' ', AIndent);
Result := Format(
ind + '<style:style style:name="ch%d" style:family="chart">' + LE +
ind + ' <style:chart-properties chart:auto-position="true" %s />' + LE +
ind + ' <style:text-properties %s%s/>' + LE +
ind + '</style:style>' + LE,
[AStyleIndex + 1,
// chart-properties
styleRotationAngle,
// text-properties
fontSize, fontColor ]
); );
end; end;
@ -7030,10 +7180,32 @@ var
backGrStyleIdx: Integer; backGrStyleIdx: Integer;
wallStyleIdx: Integer; wallStyleIdx: Integer;
floorStyleIdx: Integer; floorStyleIdx: Integer;
xAxisStyleIdx: Integer;
yAxisStyleIdx: Integer;
x2AxisStyleIdx: Integer;
y2AxisStyleIdx: Integer;
xAxisCaptionStyleIdx: Integer;
yAxisCaptionStyleIdx: Integer;
x2AxisCaptionStyleIdx: Integer;
y2AxisCaptionStyleIdx: Integer;
titleCaptionStyleIdx: Integer;
subtitleCaptionStyleIdx: Integer;
begin begin
backGrStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cstBackground); backGrStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cbtBackground);
wallStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cstWall); wallStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cbtWall);
floorStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cstFloor); floorStyleIdx := TsChartStyleList(FChartStyleList).FindChartBackgroundStyle(AChart, cbtFloor);
xAxisStyleIdx := TsChartStyleList(FChartStyleList).FindChartAxisStyle(AChart, catPrimaryX);
yAxisStyleIdx := TsChartStyleList(FChartStyleList).FindChartAxisStyle(AChart, catPrimaryY);
x2AxisStyleIdx := TsChartStyleList(FChartStyleList).FindChartAxisStyle(AChart, catSecondaryX);
y2AxisStyleIdx := TsChartStyleList(FChartStyleList).FindChartAxisStyle(AChart, catSecondaryY);
xAxisCaptionStyleIdx := TsChartStyleList(FChartStyleList).FindChartCaptionStyle(AChart, cctPrimaryX);
yAxisCaptionStyleIdx := TsChartStyleList(FChartStyleList).FindChartCaptionStyle(AChart, cctPrimaryY);
x2AxisCaptionStyleIdx := TsChartStyleList(FChartStyleList).FindChartCaptionStyle(AChart, cctSecondaryX);
y2AxisCaptionStyleIdx := TsChartStyleList(FChartStyleList).FindChartCaptionStyle(AChart, cctSecondaryY);
titleCaptionStyleIdx := TsChartStyleList(FChartStyleList).FindChartCaptionStyle(AChart, cctTitle);
subtitleCaptionStyleIdx := TsChartStyleList(FChartStyleList).FindChartCaptionStyle(AChart, cctSubtitle);
ind := DupeString(' ', AIndent); ind := DupeString(' ', AIndent);
@ -7063,7 +7235,7 @@ begin
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch 4: style for <chart:legend> element // ch 4: style for <chart:legend> element
ind + ' <style:style style:name="ch4" style:family="chart">' + LE + ind + ' <style:style style:name="ch400" style:family="chart">' + LE +
ind + ' <style:chart-properties chart:auto-position="true"/>' + LE + ind + ' <style:chart-properties chart:auto-position="true"/>' + LE +
ind + ' <style:graphic-properties draw:stroke="none" svg:stroke-color="#b3b3b3" ' + ind + ' <style:graphic-properties draw:stroke="none" svg:stroke-color="#b3b3b3" ' +
'draw:fill="none" draw:fill-color="#e6e6e6"/>' + LE + 'draw:fill="none" draw:fill-color="#e6e6e6"/>' + LE +
@ -7071,7 +7243,7 @@ begin
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch5: style for <chart:plot-area> element // ch5: style for <chart:plot-area> element
ind + ' <style:style style:name="ch5" style:family="chart">' + LE + ind + ' <style:style style:name="ch500" style:family="chart">' + LE +
ind + ' <style:chart-properties ' + ind + ' <style:chart-properties ' +
'chart:symbol-type="automatic" ' + 'chart:symbol-type="automatic" ' +
'chart:include-hidden-cells="false" ' + 'chart:include-hidden-cells="false" ' +
@ -7079,7 +7251,7 @@ begin
'chart:auto-size="true" ' + 'chart:auto-size="true" ' +
'chart:treat-empty-cells="leave-gap" ' + 'chart:treat-empty-cells="leave-gap" ' +
'chart:right-angled-axes="true"/>' + LE + 'chart:right-angled-axes="true"/>' + LE +
ind + ' </style:style>' + ind + ' </style:style>' + LE +
{ {
ind + ' <style:style style:name="ch5" style:family="chart">' + LE + ind + ' <style:style style:name="ch5" style:family="chart">' + LE +
@ -7092,7 +7264,9 @@ begin
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
} }
// ch6: style for first <chart:axis> element, primary x axis // Style for first <chart:axis> element, primary x axis
GetChartAxisStyleAsXML(AChart, xAxisStyleIdx, AIndent + 2) +
{
ind + ' <style:style style:name="ch6" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch6" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:display-label="true" ' + ind + ' <style:chart-properties chart:display-label="true" ' +
'chart:logarithmic="false" chart:reverse-direction="false" ' + 'chart:logarithmic="false" chart:reverse-direction="false" ' +
@ -7101,25 +7275,31 @@ begin
ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE + ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
}
// ch7: style for title at horizontal axes // ch7: style for title at horizontal axes
GetChartCaptionStyleAsXML(AChart, xAxisCaptionStyleIdx, AIndent + 2) +
{
ind + ' <style:style style:name="ch7" style:family="chart">' + LE + ind + ' <style:style style:name="ch7" style:family="chart">' + LE +
ind + ' <style:chart-properties chart:auto-position="true" style:rotation-angle="0"/>' + LE + ind + ' <style:chart-properties chart:auto-position="true" style:rotation-angle="0"/>' + LE +
ind + ' <style:text-properties fo:font-size="9pt" style:font-size-asian="9pt" style:font-size-complex="9pt"/>' + LE + ind + ' <style:text-properties fo:font-size="9pt" style:font-size-asian="9pt" style:font-size-complex="9pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
}
// ch8: style for major grid (all axes) // ch8: style for major grid (all axes)
ind + ' <style:style style:name="ch8" style:family="chart">' + LE + ind + ' <style:style style:name="ch800" style:family="chart">' + LE +
ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE + ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch9: style for minor grid (all axes) // ch9: style for minor grid (all axes)
ind + ' <style:style style:name="ch9" style:family="chart">' + LE + ind + ' <style:style style:name="ch900" style:family="chart">' + LE +
ind + ' <style:graphic-properties svg:stroke-color="#dddddd"/>' + LE + ind + ' <style:graphic-properties svg:stroke-color="#dddddd"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch10: style for second <chart:axis> element, secondary x axis // ch10: style for second <chart:axis> element, secondary x axis
ind + ' <style:style style:name="ch10" style:family="chart" style:data-style-name="N0">' + LE + GetChartAxisStyleAsXML(AChart, x2AxisStyleIdx, AIndent + 2) +
GetChartCaptionStyleAsXML(AChart, x2AxisCaptionStyleIdx, AIndent + 2) +
{
ind + ' <style:style style:name="ch1000" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:display-label="true" ' + ind + ' <style:chart-properties chart:display-label="true" ' +
'chart:logarithmic="false" chart:reverse-direction="false" ' + 'chart:logarithmic="false" chart:reverse-direction="false" ' +
'text:line-break="false" loext:try-staggering-first="false" ' + 'text:line-break="false" loext:try-staggering-first="false" ' +
@ -7127,9 +7307,11 @@ begin
ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE + ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
}
// ch11: style for third <chart:axis> element: primary y axis // ch11: style for third <chart:axis> element: primary y axis
ind + ' <style:style style:name="ch11" style:family="chart" style:data-style-name="N0">' + LE + GetChartAxisStyleAsXML(AChart, yAxisStyleIdx, AIndent + 2) +
{
ind + ' <style:style style:name="ch1100" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:display-label="true" ' + ind + ' <style:chart-properties chart:display-label="true" ' +
'chart:logarithmic="false" chart:reverse-direction="false" ' + 'chart:logarithmic="false" chart:reverse-direction="false" ' +
'text:line-break="false" loext:try-staggering-first="false" ' + 'text:line-break="false" loext:try-staggering-first="false" ' +
@ -7137,15 +7319,21 @@ begin
ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE + ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
}
// ch12: style for vertical axis title (both y and y2 axis) // ch12: style for vertical axis title (both y and y2 axis)
ind + ' <style:style style:name="ch12" style:family="chart">' + LE + GetChartCaptionStyleAsXML(AChart, yAxisCaptionStyleIdx, AIndent + 2) +
ind + ' <style:style style:name="ch1200" style:family="chart">' + LE +
ind + ' <style:chart-properties chart:auto-position="true" style:rotation-angle="90"/>' + LE + ind + ' <style:chart-properties chart:auto-position="true" style:rotation-angle="90"/>' + LE +
ind + ' <style:text-properties fo:font-size="9pt" style:font-size-asian="9pt" style:font-size-complex="9pt"/>' + LE + ind + ' <style:text-properties fo:font-size="9pt" style:font-size-asian="9pt" style:font-size-complex="9pt"/>' + LE +
ind + ' </style:style>' + ind + ' </style:style>' +
// ch13: style for fourth <chart:axis> element: secondary y axis // ch13: style for fourth <chart:axis> element: secondary y axis
ind + ' <style:style style:name="ch13" style:family="chart" style:data-style-name="N0">' + LE + GetChartAxisStyleAsXML(AChart, y2AxisStyleIdx, AIndent + 2) +
GetChartCaptionStyleAsXML(AChart, y2AxisCaptionStyleIdx, AIndent + 2) +
{
ind + ' <style:style style:name="ch1300" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:display-label="true" ' + ind + ' <style:chart-properties chart:display-label="true" ' +
'chart:logarithmic="false" chart:reverse-direction="false" ' + 'chart:logarithmic="false" chart:reverse-direction="false" ' +
'text:line-break="false" loext:try-staggering-first="false" ' + 'text:line-break="false" loext:try-staggering-first="false" ' +
@ -7153,9 +7341,12 @@ begin
ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE + ind + ' <style:graphic-properties svg:stroke-color="#b3b3b3"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
}
// ch14: style for frist series - this is for a line series // ch14: style for frist series - this is for a line series
ind + ' <style:style style:name="ch14" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch1400" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties ' + ind + ' <style:chart-properties ' +
'chart:symbol-type="named-symbol" ' + 'chart:symbol-type="named-symbol" ' +
'chart:symbol-name="arrow-down" ' + 'chart:symbol-name="arrow-down" ' +
@ -7180,49 +7371,49 @@ begin
*) *)
// ch15: style for second series - this is for a bar series // ch15: style for second series - this is for a bar series
ind + ' <style:style style:name="ch15" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch1500" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE + ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE +
ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#ff420e" dr3d:edge-rounding="5%"/>' + LE + ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#ff420e" dr3d:edge-rounding="5%"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch16: style for third series (bar series, here) // ch16: style for third series (bar series, here)
ind + ' <style:style style:name="ch16" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch1600" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE + ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE +
ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#ffd320" dr3d:edge-rounding="5%"/>' + LE + ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#ffd320" dr3d:edge-rounding="5%"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch17: style for 4th series (bar series, here) // ch17: style for 4th series (bar series, here)
ind + ' <style:style style:name="ch17" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch1700" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE + ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE +
ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#579d1c" dr3d:edge-rounding="5%"/>' + LE + ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#579d1c" dr3d:edge-rounding="5%"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch18: style for 5th series (bar series, here) // ch18: style for 5th series (bar series, here)
ind + ' <style:style style:name="ch18" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch1800" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE + ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE +
ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#7e0021" dr3d:edge-rounding="5%"/>' + LE + ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#7e0021" dr3d:edge-rounding="5%"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch19: style for 6th series (bar series, here) // ch19: style for 6th series (bar series, here)
ind + ' <style:style style:name="ch19" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch1900" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE + ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE +
ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#83caff" dr3d:edge-rounding="5%"/>' + LE + ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#83caff" dr3d:edge-rounding="5%"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch20: style for 7th series (bar series, here) // ch20: style for 7th series (bar series, here)
ind + ' <style:style style:name="ch20" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch2000" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE + ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE +
ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#314004" dr3d:edge-rounding="5%"/>' + LE + ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#314004" dr3d:edge-rounding="5%"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
ind + ' </style:style>' + LE + ind + ' </style:style>' + LE +
// ch21: style for 8th series (bar series, here) // ch21: style for 8th series (bar series, here)
ind + ' <style:style style:name="ch21" style:family="chart" style:data-style-name="N0">' + LE + ind + ' <style:style style:name="ch2100" style:family="chart" style:data-style-name="N0">' + LE +
ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE + ind + ' <style:chart-properties chart:link-data-style-to-source="true"/>' + LE +
ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#aecf00" dr3d:edge-rounding="5%"/>' + LE + ind + ' <style:graphic-properties draw:stroke="none" draw:fill-color="#aecf00" dr3d:edge-rounding="5%"/>' + LE +
ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE + ind + ' <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>' + LE +
@ -7574,7 +7765,7 @@ begin
if IsSubTitle then if IsSubTitle then
begin begin
elementName := 'subtitle'; elementName := 'subtitle';
titleStyleID := 3; titleStyleID := 300;
cap := AChart.SubTitle.Caption; cap := AChart.SubTitle.Caption;
end else end else
begin begin