fpspreadsheet: Add chart link demo

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9036 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-11-21 22:03:20 +00:00
parent be1d7e73f6
commit 7ea57aae2b
4 changed files with 240 additions and 0 deletions

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="chart_demo"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</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="TAChartLazarusPkg"/>
</Item>
<Item>
<PackageName Value="laz_fpspreadsheet_visual_dsgn"/>
</Item>
<Item>
<PackageName Value="laz_fpspreadsheet_visual"/>
</Item>
<Item>
<PackageName Value="LCL"/>
</Item>
</RequiredPackages>
<Units>
<Unit>
<Filename Value="chart_demo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="chart_demo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</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>

View File

@ -0,0 +1,25 @@
program chart_demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main, tachartlazaruspkg
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,63 @@
object Form1: TForm1
Left = 314
Height = 527
Top = 130
Width = 1101
Caption = 'Form1'
ClientHeight = 527
ClientWidth = 1101
LCLVersion = '3.99.0.0'
OnCreate = FormCreate
object sWorksheetGrid1: TsWorksheetGrid
Left = 0
Height = 527
Top = 0
Width = 402
FrozenCols = 0
FrozenRows = 0
PageBreakPen.Color = clBlue
PageBreakPen.Style = psDash
ReadFormulas = False
WorkbookSource = sWorkbookSource1
Align = alLeft
AutoAdvance = aaDown
DefaultColWidth = 64
DefaultRowHeight = 22
TabOrder = 0
end
object Splitter1: TSplitter
Left = 402
Height = 527
Top = 0
Width = 5
end
object Chart1: TChart
Left = 407
Height = 527
Top = 0
Width = 694
AxisList = <
item
Marks.LabelBrush.Style = bsClear
Minors = <>
Title.LabelFont.Orientation = 900
Title.LabelBrush.Style = bsClear
end
item
Alignment = calBottom
Marks.LabelBrush.Style = bsClear
Minors = <>
Title.LabelBrush.Style = bsClear
end>
Title.Text.Strings = (
'TAChart'
)
Align = alClient
end
object sWorkbookSource1: TsWorkbookSource
FileFormat = sfUser
Options = []
Left = 244
Top = 138
end
end

View File

@ -0,0 +1,59 @@
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
TAGraph,
fpSpreadsheet, fpsTypes, fpsOpenDocument,
fpSpreadsheetCtrls, fpSpreadsheetGrid, fpSpreadsheetChart;
type
{ TForm1 }
TForm1 = class(TForm)
Chart1: TChart;
Splitter1: TSplitter;
sWorkbookSource1: TsWorkbookSource;
sWorksheetGrid1: TsWorksheetGrid;
procedure FormCreate(Sender: TObject);
private
sChartLink: TsWorkbookChartLink;
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
const
FILE_NAME = '../../../other/chart/bars.ods';
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
fn: String;
begin
fn := ExpandFileName(FILE_NAME);
sWorkbookSource1.FileFormat := sfOpenDocument;
if FileExists(fn) then
sWorkbookSource1.Filename := fn;
sChartLink := TsWorkbookChartLink.Create(self);
sChartLink.Chart := Chart1;
sChartLink.WorkbookSource := sWorkbookSource1;
sChartLink.WorkbookChartIndex := 0;
end;
end.