You've already forked lazarus-ccr
fpspreadsheet: Beginning with rotated axes in chart link. Simplify generation of sample ods files.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9084 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -33,7 +33,6 @@
|
|||||||
<Unit>
|
<Unit>
|
||||||
<Filename Value="barchart_2axes_write_demo.lpr"/>
|
<Filename Value="barchart_2axes_write_demo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="barchart_write_demo"/>
|
|
||||||
</Unit>
|
</Unit>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
@ -52,11 +51,6 @@
|
|||||||
<DebugInfoType Value="dsDwarf3"/>
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
|
||||||
<ConfigFile>
|
|
||||||
<WriteConfigFilePath Value=""/>
|
|
||||||
</ConfigFile>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions>
|
<Exceptions>
|
||||||
|
@ -1,19 +1,28 @@
|
|||||||
program barchart_write_demo;
|
program barchart_2axes_write_demo;
|
||||||
|
|
||||||
{.$DEFINE DARK_MODE}
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils,
|
SysUtils,
|
||||||
fpspreadsheet, fpstypes, fpsUtils, fpschart, xlsxooxml, fpsopendocument;
|
fpspreadsheet, fpstypes, fpsUtils, fpschart, xlsxooxml, fpsopendocument;
|
||||||
|
|
||||||
|
procedure WriteHelp;
|
||||||
|
begin
|
||||||
|
WriteLn('SYNTAX: barchart_2axes_write_demo [rotated]');
|
||||||
|
WriteLn(' (no argument) ..... vertical bars');
|
||||||
|
WriteLn(' rotated ........... hoizontal bars');
|
||||||
|
Halt;
|
||||||
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
FILE_NAME = 'bars_2axes';
|
FILE_NAME = 'bars-2axes';
|
||||||
var
|
var
|
||||||
book: TsWorkbook;
|
book: TsWorkbook;
|
||||||
sheet: TsWorksheet;
|
sheet: TsWorksheet;
|
||||||
ch: TsChart;
|
ch: TsChart;
|
||||||
ser: TsChartSeries;
|
ser: TsChartSeries;
|
||||||
|
fn: String;
|
||||||
begin
|
begin
|
||||||
|
fn := FILE_NAME;
|
||||||
|
|
||||||
book := TsWorkbook.Create;
|
book := TsWorkbook.Create;
|
||||||
try
|
try
|
||||||
// worksheet
|
// worksheet
|
||||||
@ -40,15 +49,21 @@ begin
|
|||||||
ch.Legend.Border.Style := clsNoLine;
|
ch.Legend.Border.Style := clsNoLine;
|
||||||
ch.XAxis.Title.Caption := '';
|
ch.XAxis.Title.Caption := '';
|
||||||
ch.YAxis.Title.Caption := 'Count';
|
ch.YAxis.Title.Caption := 'Count';
|
||||||
ch.YAxis.Title.Font.Color := $0075ea; //597bff;
|
ch.YAxis.Title.Font.Color := $0075ea;
|
||||||
ch.YAxis.AxisLine.Color := $0075ea; //597bff;
|
ch.YAxis.AxisLine.Color := $0075ea;
|
||||||
ch.YAxis.LabelFont.Color := $0075ea; //597bff;
|
ch.YAxis.LabelFont.Color := $0075ea;
|
||||||
ch.YAxis.MajorTicks := [];
|
ch.YAxis.MajorTicks := [];
|
||||||
ch.Y2Axis.Title.Caption := 'Volume';
|
ch.Y2Axis.Title.Caption := 'Volume';
|
||||||
ch.Y2Axis.Title.Font.Color := $b08359;
|
ch.Y2Axis.Title.Font.Color := $b08359;
|
||||||
ch.Y2Axis.AxisLine.Color := $b08359;
|
ch.Y2Axis.AxisLine.Color := $b08359;
|
||||||
ch.Y2Axis.LabelFont.Color := $b08359;
|
ch.Y2Axis.LabelFont.Color := $b08359;
|
||||||
|
|
||||||
|
if (ParamCount >= 1) and (lowercase(ParamStr(1)) = 'rotated') then
|
||||||
|
begin
|
||||||
|
ch.RotatedAxes := true;
|
||||||
|
fn := fn + '-rotated';
|
||||||
|
end;
|
||||||
|
|
||||||
// Add 1st bar series ("Count")
|
// Add 1st bar series ("Count")
|
||||||
ser := TsBarSeries.Create(ch);
|
ser := TsBarSeries.Create(ch);
|
||||||
ser.YAxis := alPrimary;
|
ser.YAxis := alPrimary;
|
||||||
@ -56,7 +71,7 @@ begin
|
|||||||
ser.SetLabelRange(3, 0, 8, 0);
|
ser.SetLabelRange(3, 0, 8, 0);
|
||||||
ser.SetYRange(3, 1, 8, 1);
|
ser.SetYRange(3, 1, 8, 1);
|
||||||
ser.Fill.Style := cfsSolid;
|
ser.Fill.Style := cfsSolid;
|
||||||
ser.Fill.Color := $0075ea; //597bff;
|
ser.Fill.Color := $0075ea;
|
||||||
ser.Line.Style := clsNoLine;
|
ser.Line.Style := clsNoLine;
|
||||||
|
|
||||||
// Add 2nd bar series ("Volume")
|
// Add 2nd bar series ("Volume")
|
||||||
@ -70,12 +85,12 @@ begin
|
|||||||
ser.Line.Style := clsNoLine;
|
ser.Line.Style := clsNoLine;
|
||||||
|
|
||||||
{
|
{
|
||||||
book.WriteToFile(FILE_NAME + '.xlsx', true); // Excel fails to open the file
|
book.WriteToFile(fn + '.xlsx', true); // Excel fails to open the file
|
||||||
WriteLn('Data saved with chart in ', FILENAME, '.xlsx');
|
WriteLn('Data saved with chart in ', fn, '.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
book.WriteToFile(FILE_NAME + '.ods', true);
|
book.WriteToFile(fn + '.ods', true);
|
||||||
WriteLn('Data saved with chart in ', FILE_NAME, '.ods');
|
WriteLn('Data saved with chart in ', fn, '.ods');
|
||||||
finally
|
finally
|
||||||
book.Free;
|
book.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -6,6 +6,14 @@ uses
|
|||||||
SysUtils,
|
SysUtils,
|
||||||
fpspreadsheet, fpstypes, fpsUtils, fpschart, xlsxooxml, fpsopendocument;
|
fpspreadsheet, fpstypes, fpsUtils, fpschart, xlsxooxml, fpsopendocument;
|
||||||
|
|
||||||
|
procedure WriteHelp;
|
||||||
|
begin
|
||||||
|
WriteLn('SYNTAX: barchart_write_demo [rotated]');
|
||||||
|
WriteLn(' (no argument) ..... vertical bars');
|
||||||
|
WriteLn(' rotated ........... hoizontal bars');
|
||||||
|
Halt;
|
||||||
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
FILE_NAME = 'bars';
|
FILE_NAME = 'bars';
|
||||||
var
|
var
|
||||||
@ -13,7 +21,10 @@ var
|
|||||||
sheet: TsWorksheet;
|
sheet: TsWorksheet;
|
||||||
ch: TsChart;
|
ch: TsChart;
|
||||||
ser: TsChartSeries;
|
ser: TsChartSeries;
|
||||||
|
fn: String;
|
||||||
begin
|
begin
|
||||||
|
fn := FILE_NAME;
|
||||||
|
|
||||||
book := TsWorkbook.Create;
|
book := TsWorkbook.Create;
|
||||||
try
|
try
|
||||||
// worksheet
|
// worksheet
|
||||||
@ -44,6 +55,11 @@ begin
|
|||||||
ch.YAxis.Title.Caption := 'Grade points';
|
ch.YAxis.Title.Caption := 'Grade points';
|
||||||
ch.YAxis.AxisLine.Color := scSilver;
|
ch.YAxis.AxisLine.Color := scSilver;
|
||||||
ch.YAxis.MajorTicks := [];
|
ch.YAxis.MajorTicks := [];
|
||||||
|
if (ParamCount >= 1) and (lowercase(ParamStr(1)) = 'rotated') then
|
||||||
|
begin
|
||||||
|
ch.RotatedAxes := true;
|
||||||
|
fn := fn + '-rotated';
|
||||||
|
end;
|
||||||
|
|
||||||
// Add 1st bar series ("Student 1")
|
// Add 1st bar series ("Student 1")
|
||||||
ser := TsBarSeries.Create(ch);
|
ser := TsBarSeries.Create(ch);
|
||||||
@ -66,12 +82,12 @@ begin
|
|||||||
ser.Fill.Color := scBlue;
|
ser.Fill.Color := scBlue;
|
||||||
|
|
||||||
{
|
{
|
||||||
book.WriteToFile(FILE_NAME + '.xlsx', true); // Excel fails to open the file
|
book.WriteToFile(fn + '.xlsx', true); // Excel fails to open the file
|
||||||
WriteLn('Data saved with chart in ', FILENAME, '.xlsx');
|
WriteLn('Data saved with chart in ', fn, '.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
book.WriteToFile(FILE_NAME + '.ods', true);
|
book.WriteToFile(fn + '.ods', true);
|
||||||
WriteLn('Data saved with chart in ', FILE_NAME, '.ods');
|
WriteLn('Data saved with chart in ', fn, '.ods');
|
||||||
finally
|
finally
|
||||||
book.Free;
|
book.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
@echo off
|
||||||
|
echo Generating chart demo files:
|
||||||
|
echo.
|
||||||
|
echo Bar series...
|
||||||
|
barchart_write_demo
|
||||||
|
barchart_write_demo rotated
|
||||||
|
barchart_2axes_write_demo
|
||||||
|
barchart_2axes_write_demo rotated
|
||||||
|
echo.
|
||||||
|
echo Bubble series...
|
||||||
|
bubblechart_write_demo
|
||||||
|
echo.
|
||||||
|
echo Pie series...
|
||||||
|
piechart_write_demo
|
||||||
|
echo.
|
||||||
|
echo Radar series...
|
||||||
|
radarchart_write_demo
|
||||||
|
echo.
|
||||||
|
echo Scatter series...
|
||||||
|
scatter_write_demo lin
|
||||||
|
scatter_write_demo log
|
||||||
|
scatter_write_demo log-log
|
||||||
|
echo.
|
||||||
|
echo Scatter series and regression demo...
|
||||||
|
regressionchart_write_demo
|
||||||
|
echo.
|
||||||
|
echo StockSeries...
|
||||||
|
stock_write_demo hlc
|
||||||
|
stock_write_demo candlestick
|
||||||
|
echo.
|
||||||
|
echo StockSeries with volume...
|
||||||
|
stock_volume_write_demo hlc area
|
||||||
|
stock_volume_write_demo hlc bar
|
||||||
|
stock_volume_write_demo hlc line
|
||||||
|
stock_volume_write_demo candlestick area
|
||||||
|
stock_volume_write_demo candlestick bar
|
||||||
|
stock_volume_write_demo candlestick line
|
||||||
|
echo.
|
@ -1,73 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<CONFIG>
|
|
||||||
<ProjectOptions>
|
|
||||||
<Version Value="12"/>
|
|
||||||
<PathDelim Value="\"/>
|
|
||||||
<General>
|
|
||||||
<Flags>
|
|
||||||
<MainUnitHasCreateFormStatements Value="False"/>
|
|
||||||
<MainUnitHasTitleStatement Value="False"/>
|
|
||||||
<MainUnitHasScaledStatement Value="False"/>
|
|
||||||
</Flags>
|
|
||||||
<SessionStorage Value="InProjectDir"/>
|
|
||||||
<Title Value="scatter_log_write_demo"/>
|
|
||||||
<UseAppBundle Value="False"/>
|
|
||||||
<ResourceType Value="res"/>
|
|
||||||
</General>
|
|
||||||
<BuildModes>
|
|
||||||
<Item Name="Default" Default="True"/>
|
|
||||||
</BuildModes>
|
|
||||||
<PublishOptions>
|
|
||||||
<Version Value="2"/>
|
|
||||||
<UseFileFilters Value="True"/>
|
|
||||||
</PublishOptions>
|
|
||||||
<RunParams>
|
|
||||||
<FormatVersion Value="2"/>
|
|
||||||
</RunParams>
|
|
||||||
<RequiredPackages>
|
|
||||||
<Item>
|
|
||||||
<PackageName Value="laz_fpspreadsheet"/>
|
|
||||||
</Item>
|
|
||||||
</RequiredPackages>
|
|
||||||
<Units>
|
|
||||||
<Unit>
|
|
||||||
<Filename Value="scatter_log_write_demo.lpr"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
</Unit>
|
|
||||||
</Units>
|
|
||||||
</ProjectOptions>
|
|
||||||
<CompilerOptions>
|
|
||||||
<Version Value="11"/>
|
|
||||||
<PathDelim Value="\"/>
|
|
||||||
<Target>
|
|
||||||
<Filename Value="scatter_log_write_demo"/>
|
|
||||||
</Target>
|
|
||||||
<SearchPaths>
|
|
||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
|
||||||
</SearchPaths>
|
|
||||||
<Linking>
|
|
||||||
<Debugging>
|
|
||||||
<DebugInfoType Value="dsDwarf3"/>
|
|
||||||
</Debugging>
|
|
||||||
</Linking>
|
|
||||||
<Other>
|
|
||||||
<ConfigFile>
|
|
||||||
<WriteConfigFilePath Value=""/>
|
|
||||||
</ConfigFile>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
|
||||||
<Debugging>
|
|
||||||
<Exceptions>
|
|
||||||
<Item>
|
|
||||||
<Name Value="EAbort"/>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<Name Value="ECodetoolError"/>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<Name Value="EFOpenError"/>
|
|
||||||
</Item>
|
|
||||||
</Exceptions>
|
|
||||||
</Debugging>
|
|
||||||
</CONFIG>
|
|
@ -1,65 +0,0 @@
|
|||||||
program scatter_log_write_demo;
|
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
|
|
||||||
uses
|
|
||||||
SysUtils,
|
|
||||||
fpspreadsheet, fpstypes, fpsUtils, fpschart, xlsxooxml, fpsopendocument;
|
|
||||||
|
|
||||||
const
|
|
||||||
FILE_NAME = 'scatter_log';
|
|
||||||
var
|
|
||||||
book: TsWorkbook;
|
|
||||||
sheet: TsWorksheet;
|
|
||||||
ch: TsChart;
|
|
||||||
ser: TsScatterSeries;
|
|
||||||
begin
|
|
||||||
book := TsWorkbook.Create;
|
|
||||||
try
|
|
||||||
// Worksheet
|
|
||||||
sheet := book.AddWorksheet('test');
|
|
||||||
|
|
||||||
// Enter data
|
|
||||||
sheet.WriteText(0, 0, 'Data');
|
|
||||||
sheet.WriteFont(0, 0, '', 12, [fssBold], scBlack);
|
|
||||||
sheet.WriteText (2, 0, 'x'); sheet.Writetext (2, 1, 'y');
|
|
||||||
sheet.WriteNumber(3, 0, 0.1); sheet.WriteFormula(3, 1, 'exp(A4)');
|
|
||||||
sheet.WriteNumber(4, 0, 0.8); sheet.WriteFormula(4, 1, 'exp(A5)');
|
|
||||||
sheet.WriteNumber(5, 0, 1.4); sheet.WriteFormula(5, 1, 'exp(A6)');
|
|
||||||
sheet.WriteNumber(6, 0, 2.6); sheet.WriteFormula(6, 1, 'exp(A7)');
|
|
||||||
sheet.WriteNumber(7, 0, 4.3); sheet.WriteFormula(7, 1, 'exp(A8)');
|
|
||||||
sheet.WriteNumber(8, 0, 5.9); sheet.WriteFormula(8, 1, 'exp(A9)');
|
|
||||||
sheet.WriteNumber(9, 0, 7.5); sheet.WriteFormula(9, 1, 'exp(A10)');
|
|
||||||
|
|
||||||
// Create chart: left/top in cell D4, 150 mm x 100 mm
|
|
||||||
ch := book.AddChart(sheet, 2, 3, 150, 100);
|
|
||||||
|
|
||||||
// Chart properties
|
|
||||||
ch.Border.Style := clsNoLine;
|
|
||||||
ch.Legend.Border.Style := clsNoLine;
|
|
||||||
ch.YAxis.Logarithmic := true;
|
|
||||||
|
|
||||||
// Add scatter series
|
|
||||||
ser := TsScatterSeries.Create(ch);
|
|
||||||
|
|
||||||
// Series properties
|
|
||||||
ser.SetTitleAddr(0, 0);
|
|
||||||
ser.SetXRange(3, 0, 9, 0);
|
|
||||||
ser.SetYRange(3, 1, 9, 1);
|
|
||||||
ser.ShowLines := true;
|
|
||||||
ser.ShowSymbols := true;
|
|
||||||
ser.Symbol := cssCircle;
|
|
||||||
|
|
||||||
{
|
|
||||||
book.WriteToFile(FILE_NAME + '.xlsx', true); // Excel fails to open the file
|
|
||||||
WriteLn('Data saved with chart to ', FILE_NAME, '.xlsx');
|
|
||||||
}
|
|
||||||
|
|
||||||
book.Options := book.Options + [boCalcBeforeSaving];
|
|
||||||
book.WriteToFile(FILE_NAME + '.ods', true);
|
|
||||||
WriteLn('Data saved with chart to ', FILE_NAME, '.ods');
|
|
||||||
finally
|
|
||||||
book.Free;
|
|
||||||
end;
|
|
||||||
end.
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<CONFIG>
|
|
||||||
<ProjectOptions>
|
|
||||||
<Version Value="12"/>
|
|
||||||
<PathDelim Value="\"/>
|
|
||||||
<General>
|
|
||||||
<Flags>
|
|
||||||
<MainUnitHasCreateFormStatements Value="False"/>
|
|
||||||
<MainUnitHasTitleStatement Value="False"/>
|
|
||||||
<MainUnitHasScaledStatement Value="False"/>
|
|
||||||
</Flags>
|
|
||||||
<SessionStorage Value="InProjectDir"/>
|
|
||||||
<Title Value="scatter_loglog_write_demo"/>
|
|
||||||
<UseAppBundle Value="False"/>
|
|
||||||
<ResourceType Value="res"/>
|
|
||||||
</General>
|
|
||||||
<BuildModes>
|
|
||||||
<Item Name="Default" Default="True"/>
|
|
||||||
</BuildModes>
|
|
||||||
<PublishOptions>
|
|
||||||
<Version Value="2"/>
|
|
||||||
<UseFileFilters Value="True"/>
|
|
||||||
</PublishOptions>
|
|
||||||
<RunParams>
|
|
||||||
<FormatVersion Value="2"/>
|
|
||||||
</RunParams>
|
|
||||||
<RequiredPackages>
|
|
||||||
<Item>
|
|
||||||
<PackageName Value="laz_fpspreadsheet"/>
|
|
||||||
</Item>
|
|
||||||
</RequiredPackages>
|
|
||||||
<Units>
|
|
||||||
<Unit>
|
|
||||||
<Filename Value="scatter_loglog_write_demo.lpr"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
</Unit>
|
|
||||||
</Units>
|
|
||||||
</ProjectOptions>
|
|
||||||
<CompilerOptions>
|
|
||||||
<Version Value="11"/>
|
|
||||||
<PathDelim Value="\"/>
|
|
||||||
<Target>
|
|
||||||
<Filename Value="scatter_loglog_write_demo"/>
|
|
||||||
</Target>
|
|
||||||
<SearchPaths>
|
|
||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
|
||||||
</SearchPaths>
|
|
||||||
<Linking>
|
|
||||||
<Debugging>
|
|
||||||
<DebugInfoType Value="dsDwarf3"/>
|
|
||||||
</Debugging>
|
|
||||||
</Linking>
|
|
||||||
<Other>
|
|
||||||
<ConfigFile>
|
|
||||||
<WriteConfigFilePath Value=""/>
|
|
||||||
</ConfigFile>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
|
||||||
<Debugging>
|
|
||||||
<Exceptions>
|
|
||||||
<Item>
|
|
||||||
<Name Value="EAbort"/>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<Name Value="ECodetoolError"/>
|
|
||||||
</Item>
|
|
||||||
<Item>
|
|
||||||
<Name Value="EFOpenError"/>
|
|
||||||
</Item>
|
|
||||||
</Exceptions>
|
|
||||||
</Debugging>
|
|
||||||
</CONFIG>
|
|
@ -1,67 +0,0 @@
|
|||||||
program scatter_loglog_write_demo;
|
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
|
|
||||||
uses
|
|
||||||
SysUtils,
|
|
||||||
fpspreadsheet, fpstypes, fpsUtils, fpschart, xlsxooxml, fpsopendocument;
|
|
||||||
|
|
||||||
const
|
|
||||||
FILE_NAME = 'scatter_loglog';
|
|
||||||
var
|
|
||||||
book: TsWorkbook;
|
|
||||||
sheet: TsWorksheet;
|
|
||||||
ch: TsChart;
|
|
||||||
ser: TsScatterSeries;
|
|
||||||
begin
|
|
||||||
book := TsWorkbook.Create;
|
|
||||||
try
|
|
||||||
// Worksheet
|
|
||||||
sheet := book.AddWorksheet('test');
|
|
||||||
|
|
||||||
// Enter data
|
|
||||||
sheet.WriteText(0, 0, 'Data');
|
|
||||||
sheet.WriteFont(0, 0, '', 12, [fssBold], scBlack);
|
|
||||||
sheet.WriteText (2, 0, 'x'); sheet.Writetext (2, 1, 'y');
|
|
||||||
sheet.WriteNumber(3, 0, 0.1); sheet.WriteFormula(3, 1, 'A4^2');
|
|
||||||
sheet.WriteNumber(4, 0, 0.8); sheet.WriteFormula(4, 1, 'A5^2');
|
|
||||||
sheet.WriteNumber(5, 0, 1.9); sheet.WriteFormula(5, 1, 'A6^2');
|
|
||||||
sheet.WriteNumber(6, 0, 4.6); sheet.WriteFormula(6, 1, 'A7^2');
|
|
||||||
sheet.WriteNumber(7, 0, 8.3); sheet.WriteFormula(7, 1, 'A8^2');
|
|
||||||
sheet.WriteNumber(8, 0,15.9); sheet.WriteFormula(8, 1, 'A9^2');
|
|
||||||
sheet.WriteNumber(9, 0,25.6); sheet.WriteFormula(9, 1, 'A10^2');
|
|
||||||
sheet.WriteNumber(10,0,68.3); sheet.WriteFormula(10,1, 'A11^2');
|
|
||||||
|
|
||||||
// Create chart: left/top in cell D4, 150 mm x 100 mm
|
|
||||||
ch := book.AddChart(sheet, 2, 3, 150, 100);
|
|
||||||
|
|
||||||
// Chart properties
|
|
||||||
ch.Border.Style := clsNoLine;
|
|
||||||
ch.Legend.Border.Style := clsNoLine;
|
|
||||||
ch.XAxis.Logarithmic := true;
|
|
||||||
ch.YAxis.Logarithmic := true;
|
|
||||||
|
|
||||||
// Add scatter series
|
|
||||||
ser := TsScatterSeries.Create(ch);
|
|
||||||
|
|
||||||
// Series properties
|
|
||||||
ser.SetTitleAddr(0, 0);
|
|
||||||
ser.SetXRange(3, 0, 10, 0);
|
|
||||||
ser.SetYRange(3, 1, 10, 1);
|
|
||||||
ser.ShowLines := true;
|
|
||||||
ser.ShowSymbols := true;
|
|
||||||
ser.Symbol := cssCircle;
|
|
||||||
|
|
||||||
{
|
|
||||||
book.WriteToFile(FILE_NAME + '.xlsx', true); // Excel fails to open the file
|
|
||||||
WriteLn('Data saved with chart to ', FILE_NAME, '.xlsx');
|
|
||||||
}
|
|
||||||
|
|
||||||
book.Options := book.Options + [boCalcBeforeSaving];
|
|
||||||
book.WriteToFile(FILE_NAME + '.ods', true);
|
|
||||||
WriteLn('Data saved with chart to ', FILE_NAME, '.ods');
|
|
||||||
finally
|
|
||||||
book.Free;
|
|
||||||
end;
|
|
||||||
end.
|
|
||||||
|
|
@ -51,11 +51,6 @@
|
|||||||
<DebugInfoType Value="dsDwarf3"/>
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
|
||||||
<ConfigFile>
|
|
||||||
<WriteConfigFilePath Value=""/>
|
|
||||||
</ConfigFile>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions>
|
<Exceptions>
|
||||||
|
@ -6,6 +6,15 @@ uses
|
|||||||
SysUtils,
|
SysUtils,
|
||||||
fpspreadsheet, fpstypes, fpsUtils, fpschart, xlsxooxml, fpsopendocument;
|
fpspreadsheet, fpstypes, fpsUtils, fpschart, xlsxooxml, fpsopendocument;
|
||||||
|
|
||||||
|
procedure WriteHelp;
|
||||||
|
begin
|
||||||
|
WriteLn('SYNTAX: scatter_write_demo lin|log|loglog');
|
||||||
|
WriteLn(' lin ........... Both axes linear');
|
||||||
|
WriteLn(' log ........... y axis logarithmic');
|
||||||
|
WriteLn(' loglog ........ Both axes logarithmic');
|
||||||
|
halt;
|
||||||
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
FILE_NAME = 'scatter';
|
FILE_NAME = 'scatter';
|
||||||
var
|
var
|
||||||
@ -13,24 +22,74 @@ var
|
|||||||
sheet: TsWorksheet;
|
sheet: TsWorksheet;
|
||||||
ch: TsChart;
|
ch: TsChart;
|
||||||
ser: TsScatterSeries;
|
ser: TsScatterSeries;
|
||||||
|
fn: String;
|
||||||
|
mode: Integer; // 0=linear, 1=log, 2=log-log
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if ParamCount >= 1 then
|
||||||
|
begin
|
||||||
|
case lowercase(ParamStr(1)) of
|
||||||
|
'lin':
|
||||||
|
begin
|
||||||
|
mode := 0;
|
||||||
|
fn := FILE_NAME + '-lin';
|
||||||
|
end;
|
||||||
|
'log':
|
||||||
|
begin
|
||||||
|
mode := 1;
|
||||||
|
fn := FILE_NAME + '-log';
|
||||||
|
end;
|
||||||
|
'loglog', 'log-log':
|
||||||
|
begin
|
||||||
|
mode := 2;
|
||||||
|
fn := FILE_NAME + '-loglog';
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
WriteHelp;
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
WriteHelp;
|
||||||
|
|
||||||
book := TsWorkbook.Create;
|
book := TsWorkbook.Create;
|
||||||
try
|
try
|
||||||
// Worksheet
|
// Worksheet
|
||||||
sheet := book.AddWorksheet('test');
|
sheet := book.AddWorksheet('test');
|
||||||
|
|
||||||
// Enter data
|
// Enter data
|
||||||
sheet.WriteText (0, 0, 'Data');
|
sheet.WriteText(0, 0, 'Data');
|
||||||
sheet.WriteFont (0, 0, '', 12, [fssBold], scBlack);
|
sheet.WriteFont(0, 0, '', 12, [fssBold], scBlack);
|
||||||
sheet.WriteText ( 2, 0, 'x'); sheet.WriteText ( 2, 1, 'y');
|
sheet.WriteText ( 2, 0, 'x'); sheet.WriteText ( 2, 1, 'y');
|
||||||
sheet.WriteNumber( 3, 0, 0.1); sheet.WriteFormula( 3, 1, 'A4^2');
|
case mode of
|
||||||
sheet.WriteNumber( 4, 0, 8.8); sheet.WriteFormula( 4, 1, 'A5^2');
|
0: begin
|
||||||
sheet.WriteNumber( 5, 0,16.9); sheet.WriteFormula( 5, 1, 'A6^2');
|
sheet.WriteNumber( 3, 0, 0.1); sheet.WriteFormula( 3, 1, 'A4^2');
|
||||||
sheet.WriteNumber( 6, 0,24.6); sheet.WriteFormula( 6, 1, 'A7^2');
|
sheet.WriteNumber( 4, 0, 8.8); sheet.WriteFormula( 4, 1, 'A5^2');
|
||||||
sheet.WriteNumber( 7, 0,38.3); sheet.WriteFormula( 7, 1, 'A8^2');
|
sheet.WriteNumber( 5, 0, 16.9); sheet.WriteFormula( 5, 1, 'A6^2');
|
||||||
sheet.WriteNumber( 8, 0,45.9); sheet.WriteFormula( 8, 1, 'A9^2');
|
sheet.WriteNumber( 6, 0, 24.6); sheet.WriteFormula( 6, 1, 'A7^2');
|
||||||
sheet.WriteNumber( 9, 0,55.6); sheet.WriteFormula( 9, 1, 'A10^2');
|
sheet.WriteNumber( 7, 0, 38.3); sheet.WriteFormula( 7, 1, 'A8^2');
|
||||||
sheet.WriteNumber(10, 0,68.3); sheet.WriteFormula(10, 1, 'A11^2');
|
sheet.WriteNumber( 8, 0, 45.9); sheet.WriteFormula( 8, 1, 'A9^2');
|
||||||
|
sheet.WriteNumber( 9, 0, 55.6); sheet.WriteFormula( 9, 1, 'A10^2');
|
||||||
|
sheet.WriteNumber(10, 0, 68.3); sheet.WriteFormula(10, 1, 'A11^2');
|
||||||
|
end;
|
||||||
|
1: begin
|
||||||
|
sheet.WriteNumber(3, 0, 0.1); sheet.WriteFormula(3, 1, 'exp(A4)');
|
||||||
|
sheet.WriteNumber(4, 0, 0.8); sheet.WriteFormula(4, 1, 'exp(A5)');
|
||||||
|
sheet.WriteNumber(5, 0, 1.4); sheet.WriteFormula(5, 1, 'exp(A6)');
|
||||||
|
sheet.WriteNumber(6, 0, 2.6); sheet.WriteFormula(6, 1, 'exp(A7)');
|
||||||
|
sheet.WriteNumber(7, 0, 4.3); sheet.WriteFormula(7, 1, 'exp(A8)');
|
||||||
|
sheet.WriteNumber(8, 0, 5.9); sheet.WriteFormula(8, 1, 'exp(A9)');
|
||||||
|
sheet.WriteNumber(9, 0, 7.5); sheet.WriteFormula(9, 1, 'exp(A10)');
|
||||||
|
end;
|
||||||
|
2: begin
|
||||||
|
sheet.WriteNumber(3, 0, 0.1); sheet.WriteFormula(3, 1, 'A4^2');
|
||||||
|
sheet.WriteNumber(4, 0, 0.8); sheet.WriteFormula(4, 1, 'A5^2');
|
||||||
|
sheet.WriteNumber(5, 0, 1.9); sheet.WriteFormula(5, 1, 'A6^2');
|
||||||
|
sheet.WriteNumber(6, 0, 4.6); sheet.WriteFormula(6, 1, 'A7^2');
|
||||||
|
sheet.WriteNumber(7, 0, 8.3); sheet.WriteFormula(7, 1, 'A8^2');
|
||||||
|
sheet.WriteNumber(8, 0,15.9); sheet.WriteFormula(8, 1, 'A9^2');
|
||||||
|
sheet.WriteNumber(9, 0,25.6); sheet.WriteFormula(9, 1, 'A10^2');
|
||||||
|
sheet.WriteNumber(10,0,68.3); sheet.WriteFormula(10,1, 'A11^2');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// Create chart: left/top in cell D4, 150 mm x 100 mm
|
// Create chart: left/top in cell D4, 150 mm x 100 mm
|
||||||
ch := book.AddChart(sheet, 2, 3, 150, 100);
|
ch := book.AddChart(sheet, 2, 3, 150, 100);
|
||||||
@ -38,6 +97,17 @@ begin
|
|||||||
// Chart properties
|
// Chart properties
|
||||||
ch.Border.Style := clsNoLine;
|
ch.Border.Style := clsNoLine;
|
||||||
ch.Legend.Border.Style := clsNoLine;
|
ch.Legend.Border.Style := clsNoLine;
|
||||||
|
// Set up logarithmic axes if needed.
|
||||||
|
case mode of
|
||||||
|
0: ;
|
||||||
|
1: ch.YAxis.Logarithmic := true;
|
||||||
|
2: begin
|
||||||
|
ch.XAxis.Logarithmic := true;
|
||||||
|
ch.XAxis.Max := 100;
|
||||||
|
ch.XAxis.AutomaticMax := false;
|
||||||
|
ch.YAxis.Logarithmic := true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// Add scatter series
|
// Add scatter series
|
||||||
ser := TsScatterSeries.Create(ch);
|
ser := TsScatterSeries.Create(ch);
|
||||||
@ -56,8 +126,8 @@ begin
|
|||||||
}
|
}
|
||||||
|
|
||||||
book.Options := book.Options + [boCalcBeforeSaving];
|
book.Options := book.Options + [boCalcBeforeSaving];
|
||||||
book.WriteToFile(FILE_NAME + '.ods', true);
|
book.WriteToFile(fn + '.ods', true);
|
||||||
WriteLn('Data saved with chart to ', FILE_NAME, '.ods');
|
WriteLn('Data saved with chart to ', fn, '.ods');
|
||||||
finally
|
finally
|
||||||
book.Free;
|
book.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -8,7 +8,6 @@ uses
|
|||||||
|
|
||||||
const
|
const
|
||||||
FILE_NAME = 'stock-vol';
|
FILE_NAME = 'stock-vol';
|
||||||
CANDLE_STICK = true; //false;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
book: TsWorkbook;
|
book: TsWorkbook;
|
||||||
@ -19,6 +18,19 @@ var
|
|||||||
r: Integer;
|
r: Integer;
|
||||||
d: TDate;
|
d: TDate;
|
||||||
fn: String;
|
fn: String;
|
||||||
|
candleStickMode: Boolean;
|
||||||
|
volumeMode: char;
|
||||||
|
|
||||||
|
procedure WriteHelp;
|
||||||
|
begin
|
||||||
|
WriteLn('SYNTAX: stock_volume_write_demo hlc|candlestick bar|area|line');
|
||||||
|
WriteLn(' hlc ........... Create high-low-close series');
|
||||||
|
WriteLn(' candlestick ... Create candle-stick series');
|
||||||
|
WriteLn(' area .......... Display volume as area series');
|
||||||
|
WriteLn(' bar ........... Display volume as bar series');
|
||||||
|
WriteLn(' line .......... Display volume as line series');
|
||||||
|
halt;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure WriteData(var ARow: Integer; var ADate: TDate; AVolume, AOpen, AHigh, ALow, AClose: Double);
|
procedure WriteData(var ARow: Integer; var ADate: TDate; AVolume, AOpen, AHigh, ALow, AClose: Double);
|
||||||
begin
|
begin
|
||||||
@ -33,6 +45,44 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if ParamCount >= 2 then
|
||||||
|
begin
|
||||||
|
case lowercase(ParamStr(1)) of
|
||||||
|
'hlc':
|
||||||
|
begin
|
||||||
|
candleStickMode := false;
|
||||||
|
fn := FILE_NAME + '-hlc';
|
||||||
|
end;
|
||||||
|
'candlestick':
|
||||||
|
begin
|
||||||
|
candleStickMode := true;
|
||||||
|
fn := FILE_NAME + '-candlestick';
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
WriteHelp;
|
||||||
|
end;
|
||||||
|
case lowercase(ParamStr(2)) of
|
||||||
|
'area':
|
||||||
|
begin
|
||||||
|
volumeMode := 'a';
|
||||||
|
fn := fn + '-area';
|
||||||
|
end;
|
||||||
|
'bar', 'bars':
|
||||||
|
begin
|
||||||
|
volumeMode := 'b';
|
||||||
|
fn := fn + '-bars';
|
||||||
|
end;
|
||||||
|
'line':
|
||||||
|
begin
|
||||||
|
volumeMode := 'l';
|
||||||
|
fn := fn + '-line';
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
WriteHelp;
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
WriteHelp;
|
||||||
|
|
||||||
book := TsWorkbook.Create;
|
book := TsWorkbook.Create;
|
||||||
try
|
try
|
||||||
// Worksheet
|
// Worksheet
|
||||||
@ -89,33 +139,29 @@ begin
|
|||||||
|
|
||||||
// Stock series properties
|
// Stock series properties
|
||||||
ser.YAxis := alPrimary;
|
ser.YAxis := alPrimary;
|
||||||
ser.CandleStick := CANDLE_STICK;
|
ser.CandleStick := candleStickMode;
|
||||||
ser.CandleStickUpFill.Color := scGreen;
|
ser.CandleStickUpFill.Color := scGreen;
|
||||||
ser.CandlestickDownFill.Color := scRed;
|
ser.CandlestickDownFill.Color := scRed;
|
||||||
ser.SetTitleAddr (0, 0);
|
ser.SetTitleAddr (0, 0);
|
||||||
if CANDLE_STICK then ser.SetOpenRange (3, 2, 7, 2);
|
if candleStickMode then ser.SetOpenRange (3, 2, 7, 2);
|
||||||
ser.SetHighRange (3, 3, 7, 3);
|
ser.SetHighRange (3, 3, 7, 3);
|
||||||
ser.SetLowRange (3, 4, 7, 4);
|
ser.SetLowRange (3, 4, 7, 4);
|
||||||
ser.SetCloseRange(3, 5, 7, 5);
|
ser.SetCloseRange(3, 5, 7, 5);
|
||||||
ser.SetLabelRange(3, 0, 7, 0);
|
ser.SetLabelRange(3, 0, 7, 0);
|
||||||
|
|
||||||
// Add bar series for volume data
|
// Add series for volume data, type depending on 2nd commandline argument
|
||||||
// (Activate one of the three next lines)
|
case volumeMode of
|
||||||
vser := TsBarSeries.Create(ch);
|
'a': vser := TsAreaSeries.Create(ch);
|
||||||
//vser := TsAreaSeries.Create(ch);
|
'b': vser := TsBarSeries.Create(ch);
|
||||||
//vser := TsLineSeries.Create(ch);
|
'l': vser := TsLineSeries.Create(ch);
|
||||||
|
end;
|
||||||
|
|
||||||
// Bar series properties
|
// Volume series properties
|
||||||
vser.YAxis := alSecondary;
|
vser.YAxis := alSecondary;
|
||||||
vser.SetLabelRange(3, 0, 7, 0);
|
vser.SetLabelRange(3, 0, 7, 0);
|
||||||
vser.SetYRange (3, 1, 7, 1);
|
vser.SetYRange (3, 1, 7, 1);
|
||||||
vser.SetTitleAddr (2, 1);
|
vser.SetTitleAddr (2, 1);
|
||||||
|
|
||||||
if CANDLE_STICK then
|
|
||||||
fn := FILE_NAME + '-candle'
|
|
||||||
else
|
|
||||||
fn := FILE_NAME + '-hlc';
|
|
||||||
|
|
||||||
{
|
{
|
||||||
book.WriteToFile(fn + '.xlsx', true); // Excel fails to open the file
|
book.WriteToFile(fn + '.xlsx', true); // Excel fails to open the file
|
||||||
WriteLn('Data saved with chart to ', fn, '.xlsx');
|
WriteLn('Data saved with chart to ', fn, '.xlsx');
|
||||||
|
@ -8,7 +8,6 @@ uses
|
|||||||
|
|
||||||
const
|
const
|
||||||
FILE_NAME = 'stock';
|
FILE_NAME = 'stock';
|
||||||
CANDLE_STICK = false;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
book: TsWorkbook;
|
book: TsWorkbook;
|
||||||
@ -18,6 +17,15 @@ var
|
|||||||
r: Integer;
|
r: Integer;
|
||||||
d: TDate;
|
d: TDate;
|
||||||
fn: String;
|
fn: String;
|
||||||
|
candlestickMode: Boolean;
|
||||||
|
|
||||||
|
procedure WriteHelp;
|
||||||
|
begin
|
||||||
|
WriteLn('SYNTAX: stock_write_demo hlc|candlestick');
|
||||||
|
WriteLn(' hlc ........... Create high-low-close series');
|
||||||
|
WriteLn(' candlestick ... Create candle-stick series');
|
||||||
|
halt;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure WriteData(var ARow: Integer; var ADate: TDate; AOpen, AHigh, ALow, AClose: Double);
|
procedure WriteData(var ARow: Integer; var ADate: TDate; AOpen, AHigh, ALow, AClose: Double);
|
||||||
begin
|
begin
|
||||||
@ -31,6 +39,25 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if ParamCount >= 1 then
|
||||||
|
begin
|
||||||
|
case lowercase(ParamStr(1)) of
|
||||||
|
'hlc':
|
||||||
|
begin
|
||||||
|
candleStickMode := false;
|
||||||
|
fn := FILE_NAME + '-hlc';
|
||||||
|
end;
|
||||||
|
'candlestick':
|
||||||
|
begin
|
||||||
|
candleStickMode := true;
|
||||||
|
fn := FILE_NAME + '-candlestick';
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
WriteHelp;
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
WriteHelp;
|
||||||
|
|
||||||
book := TsWorkbook.Create;
|
book := TsWorkbook.Create;
|
||||||
try
|
try
|
||||||
// Worksheet
|
// Worksheet
|
||||||
@ -74,22 +101,17 @@ begin
|
|||||||
ser := TsStockSeries.Create(ch);
|
ser := TsStockSeries.Create(ch);
|
||||||
|
|
||||||
// Series properties
|
// Series properties
|
||||||
ser.CandleStick := CANDLE_STICK;
|
ser.CandleStick := candleStickMode;
|
||||||
ser.CandleStickUpFill.Color := scGreen;
|
ser.CandleStickUpFill.Color := scGreen;
|
||||||
ser.CandlestickDownFill.Color := scRed;
|
ser.CandlestickDownFill.Color := scRed;
|
||||||
ser.SetTitleAddr (0, 0);
|
ser.SetTitleAddr (0, 0);
|
||||||
if CANDLE_STICK then ser.SetOpenRange (3, 1, 7, 1);
|
if candleStickMode then ser.SetOpenRange (3, 1, 7, 1);
|
||||||
ser.SetHighRange (3, 2, 7, 2);
|
ser.SetHighRange (3, 2, 7, 2);
|
||||||
ser.SetLowRange (3, 3, 7, 3);
|
ser.SetLowRange (3, 3, 7, 3);
|
||||||
ser.SetCloseRange(3, 4, 7, 4);
|
ser.SetCloseRange(3, 4, 7, 4);
|
||||||
ser.SetXRange (3, 0, 7, 0);
|
ser.SetXRange (3, 0, 7, 0);
|
||||||
ser.SetLabelRange(3, 0, 7, 0);
|
ser.SetLabelRange(3, 0, 7, 0);
|
||||||
|
|
||||||
if CANDLE_STICK then
|
|
||||||
fn := FILE_NAME + '-candle'
|
|
||||||
else
|
|
||||||
fn := FILE_NAME + '-hlc';
|
|
||||||
|
|
||||||
{
|
{
|
||||||
book.WriteToFile(fn + '.xlsx', true); // Excel fails to open the file
|
book.WriteToFile(fn + '.xlsx', true); // Excel fails to open the file
|
||||||
WriteLn('Data saved with chart to ', fn, '.xlsx');
|
WriteLn('Data saved with chart to ', fn, '.xlsx');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 314
|
Left = 467
|
||||||
Height = 527
|
Height = 527
|
||||||
Top = 130
|
Top = 160
|
||||||
Width = 1351
|
Width = 1351
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 527
|
ClientHeight = 527
|
||||||
@ -22,6 +22,7 @@ object Form1: TForm1
|
|||||||
WorkbookSource = sWorkbookSource1
|
WorkbookSource = sWorkbookSource1
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
AutoAdvance = aaDown
|
AutoAdvance = aaDown
|
||||||
|
Color = clWhite
|
||||||
DefaultColWidth = 64
|
DefaultColWidth = 64
|
||||||
DefaultRowHeight = 22
|
DefaultRowHeight = 22
|
||||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goSmoothScroll]
|
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goSmoothScroll]
|
||||||
@ -93,18 +94,25 @@ object Form1: TForm1
|
|||||||
DropDownCount = 32
|
DropDownCount = 32
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'../../../other/chart/area.ods'
|
|
||||||
'../../../other/chart/bars.ods'
|
'../../../other/chart/bars.ods'
|
||||||
'../../../other/chart/bars_2axes.ods'
|
'../../../other/chart/bars-rotated.ods'
|
||||||
|
'../../../other/chart/bars-2axes.ods'
|
||||||
|
'../../../other/chart/bars-2axes-rotated.ods'
|
||||||
'../../../other/chart/bubble.ods'
|
'../../../other/chart/bubble.ods'
|
||||||
'../../../other/chart/pie.ods'
|
'../../../other/chart/pie.ods'
|
||||||
'../../../other/chart/radar.ods'
|
'../../../other/chart/radar.ods'
|
||||||
'../../../other/chart/regression.ods'
|
'../../../other/chart/regression.ods'
|
||||||
'../../../other/chart/scatter.ods'
|
'../../../other/chart/scatter-lin.ods'
|
||||||
'../../../other/chart/scatter_log.ods'
|
'../../../other/chart/scatter-log.ods'
|
||||||
'../../../other/chart/scatter_loglog.ods'
|
'../../../other/chart/scatter-loglog.ods'
|
||||||
'../../../other/chart/stock-candle.ods'
|
'../../../other/chart/stock-candlestick.ods'
|
||||||
'../../../other/chart/stock-hlc.ods'
|
'../../../other/chart/stock-hlc.ods'
|
||||||
|
'../../../other/chart/stock-vol-candlestick-area.ods'
|
||||||
|
'../../../other/chart/stock-vol-candlestick-bars.ods'
|
||||||
|
'../../../other/chart/stock-vol-candlestick-line.ods'
|
||||||
|
'../../../other/chart/stock-vol-hlc-area.ods'
|
||||||
|
'../../../other/chart/stock-vol-hlc-bars.ods'
|
||||||
|
'../../../other/chart/stock-vol-hlc-line.ods'
|
||||||
)
|
)
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnCloseUp = ComboBox1CloseUp
|
OnCloseUp = ComboBox1CloseUp
|
||||||
|
@ -1050,15 +1050,23 @@ begin
|
|||||||
case nodeName of
|
case nodeName of
|
||||||
'style:chart-properties':
|
'style:chart-properties':
|
||||||
begin
|
begin
|
||||||
|
// Stacked
|
||||||
s := GetAttrValue(AStyleNode, 'chart:stacked');
|
s := GetAttrValue(AStyleNode, 'chart:stacked');
|
||||||
if s = 'true' then
|
if s = 'true' then
|
||||||
AChart.StackMode := csmStacked;
|
AChart.StackMode := csmStacked;
|
||||||
|
// Stacked as percentage
|
||||||
s := GetAttrValue(AStyleNode, 'chart:percentage');
|
s := GetAttrValue(AStyleNode, 'chart:percentage');
|
||||||
if s = 'true' then
|
if s = 'true' then
|
||||||
AChart.StackMode := csmStackedPercentage;
|
AChart.StackMode := csmStackedPercentage;
|
||||||
|
// Horizontal bars
|
||||||
|
s := GetAttrValue(AStyleNode, 'chart:vertical');
|
||||||
|
if s = 'true' then
|
||||||
|
AChart.RotatedAxes := true;
|
||||||
|
// Pie series start angle
|
||||||
s := GetAttrValue(AStyleNode, 'chart:angle-offset');
|
s := GetAttrValue(AStyleNode, 'chart:angle-offset');
|
||||||
if s <> '' then
|
if s <> '' then
|
||||||
FPieSeriesStartAngle := StrToInt(s);
|
FPieSeriesStartAngle := StrToInt(s);
|
||||||
|
// Stockseries candlestick mode
|
||||||
s := GetAttrValue(AStyleNode, 'chart:japanese-candle-stick');
|
s := GetAttrValue(AStyleNode, 'chart:japanese-candle-stick');
|
||||||
if (s <> '') and (FStockSeries <> nil) then
|
if (s <> '') and (FStockSeries <> nil) then
|
||||||
FStockSeries.CandleStick := true;
|
FStockSeries.CandleStick := true;
|
||||||
|
@ -1022,18 +1022,30 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TsWorkbookChartLink.ActiveChartSeries(ASeries: TsChartSeries): TChartSeries;
|
function TsWorkbookChartLink.ActiveChartSeries(ASeries: TsChartSeries): TChartSeries;
|
||||||
|
type
|
||||||
|
TAxisType = (xAx, yAx);
|
||||||
|
const
|
||||||
|
AXIS_ALIGNMENT: array[boolean, TsChartAxisLink, TAxisType] of TChartAxisAlignment = (
|
||||||
|
( (calBottom, calLeft), // not rotated - primary
|
||||||
|
(calTop, calRight) ), // not rotated - secondary
|
||||||
|
( (calLeft, calBottom), // rotated - primary
|
||||||
|
(calRight, calTop) ) // rotated - secondary
|
||||||
|
);
|
||||||
var
|
var
|
||||||
stackable: Boolean;
|
stackable: Boolean;
|
||||||
firstSeries: TChartSeries;
|
firstSeries: TChartSeries;
|
||||||
|
ch: TsChart;
|
||||||
src: TsWorkbookChartSource;
|
src: TsWorkbookChartSource;
|
||||||
calcSrc: TCalculatedChartSource;
|
calcSrc: TCalculatedChartSource;
|
||||||
style: TChartStyle;
|
style: TChartStyle;
|
||||||
|
axAlign: TChartAxisAlignment;
|
||||||
begin
|
begin
|
||||||
if FChart.Series.Count > 0 then
|
if FChart.Series.Count > 0 then
|
||||||
firstSeries := FChart.Series[0] as TChartSeries
|
firstSeries := FChart.Series[0] as TChartSeries
|
||||||
else
|
else
|
||||||
firstSeries := nil;
|
firstSeries := nil;
|
||||||
|
|
||||||
|
ch := ASeries.Chart;
|
||||||
stackable := IsStackable(ASeries);
|
stackable := IsStackable(ASeries);
|
||||||
|
|
||||||
if stackable and (firstSeries <> nil) then
|
if stackable and (firstSeries <> nil) then
|
||||||
@ -1145,6 +1157,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Assign series index to axis for primary and secondary axes support
|
// Assign series index to axis for primary and secondary axes support
|
||||||
|
axAlign := AXIS_ALIGNMENT[ch.RotatedAxes, ASeries.XAxis, xAx];
|
||||||
|
Result.AxisIndexX := FChart.AxisList.GetAxisByAlign(axAlign).Index;
|
||||||
|
axAlign := AXIS_ALIGNMENT[ch.RotatedAxes, ASeries.YAxis, yAx];
|
||||||
|
Result.AxisIndexY := FChart.AxisList.GetAxisByAlign(axAlign).Index;
|
||||||
|
{
|
||||||
case ASeries.XAxis of
|
case ASeries.XAxis of
|
||||||
alPrimary:
|
alPrimary:
|
||||||
Result.AxisIndexX := FChart.AxisList.GetAxisByAlign(calBottom).Index;
|
Result.AxisIndexX := FChart.AxisList.GetAxisByAlign(calBottom).Index;
|
||||||
@ -1157,6 +1174,7 @@ begin
|
|||||||
alSecondary:
|
alSecondary:
|
||||||
Result.AxisIndexY := FChart.AxisList.GetAxisByAlign(calRight).Index;
|
Result.AxisIndexY := FChart.AxisList.GetAxisByAlign(calRight).Index;
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
|
|
||||||
if stackable then
|
if stackable then
|
||||||
begin
|
begin
|
||||||
@ -1840,13 +1858,13 @@ begin
|
|||||||
logTransf.Enabled := AWorkbookAxis.Logarithmic;
|
logTransf.Enabled := AWorkbookAxis.Logarithmic;
|
||||||
if AWorkbookAxis.Logarithmic then
|
if AWorkbookAxis.Logarithmic then
|
||||||
begin
|
begin
|
||||||
axis.Intervals.Options := axis.Intervals.Options + [aipGraphCoords];
|
axis.Intervals.Options := axis.Intervals.Options + [aipGraphCoords{$IF LCL_FullVersion >= 3990000}, aipInteger{$IFEND}];
|
||||||
axis.Intervals.MaxLength := 150;
|
axis.Intervals.MaxLength := 150;
|
||||||
axis.Intervals.MinLength := 30;
|
axis.Intervals.MinLength := 30;
|
||||||
axis.Intervals.Tolerance := 30;
|
axis.Intervals.Tolerance := 30;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
axis.Intervals.Options := axis.Intervals.Options - [aipGraphCoords];
|
axis.Intervals.Options := axis.Intervals.Options - [aipGraphCoords{$IF LCL_FullVersion >= 3990000}, aipInteger{$IFEND}];
|
||||||
axis.Intervals.MaxLength := 100;
|
axis.Intervals.MaxLength := 100;
|
||||||
axis.Intervals.MinLength := 20;
|
axis.Intervals.MinLength := 20;
|
||||||
axis.Intervals.Tolerance := 0;
|
axis.Intervals.Tolerance := 0;
|
||||||
|
Reference in New Issue
Block a user