diff --git a/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/chart_demo.lpi b/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/chart_demo.lpi new file mode 100644 index 000000000..d59e9b4e0 --- /dev/null +++ b/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/chart_demo.lpi @@ -0,0 +1,93 @@ + + + + + + + + + <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> diff --git a/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/chart_demo.lpr b/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/chart_demo.lpr new file mode 100644 index 000000000..7af959198 --- /dev/null +++ b/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/chart_demo.lpr @@ -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. + diff --git a/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/main.lfm b/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/main.lfm new file mode 100644 index 000000000..b21b327ea --- /dev/null +++ b/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/main.lfm @@ -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 diff --git a/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/main.pas b/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/main.pas new file mode 100644 index 000000000..d97b9805d --- /dev/null +++ b/components/fpspreadsheet/examples/visual/fpschart/fpschartlink/main.pas @@ -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. +