diff --git a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.ico b/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.ico deleted file mode 100644 index 0341321b5..000000000 Binary files a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.ico and /dev/null differ diff --git a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.lpi b/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.lpi deleted file mode 100644 index 5e079ec69..000000000 --- a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.lpi +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.lpr b/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.lpr deleted file mode 100644 index 037314886..000000000 --- a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/fpschart.lpr +++ /dev/null @@ -1,21 +0,0 @@ -program fpschart; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Interfaces, // this includes the LCL widgetset - Forms, tachartlazaruspkg, mainform, laz_fpspreadsheet_visual, - laz_fpspreadsheet; - -{$R *.res} - -begin - Application.Title:=''; - Application.Initialize; - Application.CreateForm(TFPSChartForm, FPSChartForm); - Application.Run; -end. - diff --git a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/mainform.lfm b/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/mainform.lfm deleted file mode 100644 index 560f98636..000000000 --- a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/mainform.lfm +++ /dev/null @@ -1,192 +0,0 @@ -object FPSChartForm: TFPSChartForm - Left = 259 - Height = 382 - Top = 146 - Width = 697 - Caption = 'FPSpreadsheet Chart Example' - ClientHeight = 382 - ClientWidth = 697 - OnCreate = FormCreate - LCLVersion = '1.7' - object MyChart: TChart - AnchorSideLeft.Control = Bevel1 - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = editXAxis - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 352 - Height = 263 - Top = 111 - Width = 337 - AxisList = < - item - Minors = <> - Title.LabelFont.Orientation = 900 - end - item - Alignment = calBottom - Marks.LabelFont.Orientation = 900 - Marks.Format = '%2:s' - Marks.Source = FPSChartSource - Marks.Style = smsLabel - Minors = <> - end> - BackColor = clWhite - Foot.Brush.Color = clBtnFace - Foot.Font.Color = clBlue - Title.Brush.Color = clBtnFace - Title.Font.Color = clBlue - Title.Text.Strings = ( - 'TAChart' - ) - Anchors = [akTop, akLeft, akRight, akBottom] - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - object MyChartBarSeries1: TBarSeries - BarBrush.Color = clRed - Source = FPSChartSource - end - end - object WorksheetGrid: TsWorksheetGrid - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = editXAxis - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Bevel1 - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 8 - Height = 263 - Top = 111 - Width = 336 - FrozenCols = 0 - FrozenRows = 0 - ReadFormulas = False - TextOverflow = True - WorkbookSource = WorksheetGrid.internal - Anchors = [akTop, akLeft, akRight, akBottom] - AutoAdvance = aaDown - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - BorderSpacing.Bottom = 8 - ColCount = 27 - DefaultColWidth = 64 - DefaultRowHeight = 22 - ExtendedSelect = False - Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goThumbTracking] - RowCount = 101 - TabOrder = 1 - end - object btnCreateGraphic: TButton - Left = 464 - Height = 25 - Top = 48 - Width = 128 - Caption = 'Create Graphic' - OnClick = btnCreateGraphicClick - TabOrder = 2 - end - object Label1: TLabel - Left = 14 - Height = 42 - Top = 4 - Width = 678 - Anchors = [akTop, akLeft, akRight] - AutoSize = False - Caption = 'Please add data to the grid or load it from a file, then choose the location of the data for the X and Y axises and click on the button "Create Graphic" to generate a chart.' - ParentColor = False - WordWrap = True - end - object editSourceFile: TFileNameEdit - Left = 152 - Height = 23 - Top = 48 - Width = 136 - FileName = 't1.xls' - DialogOptions = [] - FilterIndex = 0 - HideDirectories = False - ButtonWidth = 23 - NumGlyphs = 1 - MaxLength = 0 - TabOrder = 3 - Text = 't1.xls' - end - object Label2: TLabel - Left = 14 - Height = 15 - Top = 51 - Width = 106 - Caption = 'Source Spreadsheet:' - ParentColor = False - end - object btnLoadSpreadsheet: TButton - Left = 320 - Height = 25 - Top = 48 - Width = 75 - Caption = 'Load' - OnClick = btnLoadSpreadsheetClick - TabOrder = 4 - end - object editXAxis: TLabeledEdit - Left = 64 - Height = 23 - Top = 80 - Width = 80 - EditLabel.AnchorSideTop.Control = editXAxis - EditLabel.AnchorSideTop.Side = asrCenter - EditLabel.AnchorSideRight.Control = editXAxis - EditLabel.AnchorSideBottom.Control = editXAxis - EditLabel.AnchorSideBottom.Side = asrBottom - EditLabel.Left = 25 - EditLabel.Height = 15 - EditLabel.Top = 84 - EditLabel.Width = 36 - EditLabel.Caption = 'X-Axis:' - EditLabel.ParentColor = False - LabelPosition = lpLeft - TabOrder = 5 - Text = 'A3:A14' - end - object EditYAxis: TLabeledEdit - Left = 208 - Height = 23 - Top = 80 - Width = 80 - EditLabel.AnchorSideTop.Control = EditYAxis - EditLabel.AnchorSideTop.Side = asrCenter - EditLabel.AnchorSideRight.Control = EditYAxis - EditLabel.AnchorSideBottom.Control = EditYAxis - EditLabel.AnchorSideBottom.Side = asrBottom - EditLabel.Left = 169 - EditLabel.Height = 15 - EditLabel.Top = 84 - EditLabel.Width = 36 - EditLabel.Caption = 'Y-Axis:' - EditLabel.ParentColor = False - LabelPosition = lpLeft - TabOrder = 6 - Text = 'B3:B14' - end - object Bevel1: TBevel - AnchorSideLeft.Control = Owner - AnchorSideLeft.Side = asrCenter - Left = 344 - Height = 50 - Top = 83 - Width = 8 - Shape = bsSpacer - end - object FPSChartSource: TsWorksheetChartSource - PointsNumber = 5 - YFirstCellCol = 1 - XSelectionDirection = fpsVerticalSelection - YSelectionDirection = fpsVerticalSelection - left = 512 - top = 200 - end -end diff --git a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/mainform.pas b/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/mainform.pas deleted file mode 100644 index 64882e44d..000000000 --- a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/mainform.pas +++ /dev/null @@ -1,75 +0,0 @@ -unit mainform; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - StdCtrls, EditBtn, ExtCtrls, - fpspreadsheetchart, fpspreadsheetgrid, - TAGraph, TASeries; - -type - - { TFPSChartForm } - - TFPSChartForm = class(TForm) - Bevel1: TBevel; - btnCreateGraphic: TButton; - btnLoadSpreadsheet: TButton; - editSourceFile: TFileNameEdit; - Label1: TLabel; - Label2: TLabel; - editXAxis: TLabeledEdit; - EditYAxis: TLabeledEdit; - MyChart: TChart; - FPSChartSource: TsWorksheetChartSource; - MyChartBarSeries1: TBarSeries; - WorksheetGrid: TsWorksheetGrid; - procedure btnCreateGraphicClick(Sender: TObject); - procedure btnLoadSpreadsheetClick(Sender: TObject); - procedure FormCreate(Sender: TObject); - private - { private declarations } - public - { public declarations } - end; - -var - FPSChartForm: TFPSChartForm; - -implementation - -uses - // FPSpreadsheet and supported formats - fpspreadsheet, xlsbiff8, xlsbiff5, xlsbiff2, xlsxooxml, fpsopendocument; - -{$R *.lfm} - -{ TFPSChartForm } - -procedure TFPSChartForm.btnCreateGraphicClick(Sender: TObject); -begin - FPSChartSource.LoadPropertiesFromStrings(editXAxis.Text, editYAxis.Text, '', '', ''); - FPSChartSource.LoadFromWorksheetGrid(WorksheetGrid); -end; - -procedure TFPSChartForm.btnLoadSpreadsheetClick(Sender: TObject); -begin - WorksheetGrid.LoadFromSpreadsheetFile(editSourceFile.Text); -end; - -procedure TFPSChartForm.FormCreate(Sender: TObject); -begin - editSourceFile.InitialDir := ExtractFilePath(ParamStr(0)); - // Property Text is not published in older versions of Lazarus - editSourceFile.Text := 't1.xls'; -end; - -initialization - // Property Text is not published in older versions of Lazarus - RegisterPropertyToSkip(TFileNameEdit, 'Text', 'Not used in Laz 1.0', ''); - -end. - diff --git a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/readme.txt b/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/readme.txt deleted file mode 100644 index 67c9672f1..000000000 --- a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -This demo shows usage of the TsWorksheetChartSource component for -creating charts from spreadsheet data. diff --git a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/t1.xls b/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/t1.xls deleted file mode 100644 index 8298e8cf3..000000000 Binary files a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/t1.xls and /dev/null differ diff --git a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/t2.ods b/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/t2.ods deleted file mode 100644 index 819f6d8bf..000000000 Binary files a/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource-deprecated/t2.ods and /dev/null differ diff --git a/components/fpspreadsheet/source/design/fpsvisualreg.pas b/components/fpspreadsheet/source/design/fpsvisualreg.pas index 12fbce6fc..2266c5a7d 100644 --- a/components/fpspreadsheet/source/design/fpsvisualreg.pas +++ b/components/fpspreadsheet/source/design/fpsvisualreg.pas @@ -36,7 +36,6 @@ begin ]); RegisterComponents('Chart', [ - TsWorksheetChartSource, TsWorkbookChartSource ]); diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas index 6c496f8b9..28b6c6e8a 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas @@ -33,50 +33,6 @@ type The data can be loaded from a TsWorksheetGrid Grid component or directly from a TsWorksheet FPSpreadsheet Worksheet } - { TsWorksheetChartSource } - - { DEPRECTATED - use TsWorkbookChartSource instead! } - - TsWorksheetChartSource = class(TCustomChartSource) - private - FInternalWorksheet: TsWorksheet; - FPointsNumber: Integer; - FXSelectionDirection: TsSelectionDirection; - FYSelectionDirection: TsSelectionDirection; - FXFirstCellCol: Cardinal; - FXFirstCellRow: Cardinal; - FYFirstCellCol: Cardinal; - FYFirstCellRow: Cardinal; - procedure SetPointsNumber(const AValue: Integer); - procedure SetXSelectionDirection(const AValue: TsSelectionDirection); - procedure SetYSelectionDirection(const AValue: TsSelectionDirection); - procedure SetXFirstCellCol(const AValue: Cardinal); - procedure SetXFirstCellRow(const AValue: Cardinal); - procedure SetYFirstCellCol(const AValue: Cardinal); - procedure SetYFirstCellRow(const AValue: Cardinal); - protected - FDataWorksheet: TsWorksheet; - FCurItem: TChartDataItem; - function GetCount: Integer; override; - function GetItem(AIndex: Integer): PChartDataItem; override; - procedure SetYCount(AValue: Cardinal); override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure LoadPropertiesFromStrings(AXInterval, AYInterval, AXTitle, AYTitle, ATitle: string); - public - procedure LoadFromWorksheetGrid(const AValue: TsWorksheetGrid); - published - property PointsNumber: Integer read FPointsNumber write SetPointsNumber default 0; - property XFirstCellCol: Cardinal read FXFirstCellCol write SetXFirstCellCol default 0; - property XFirstCellRow: Cardinal read FXFirstCellRow write SetXFirstCellRow default 0; - property YFirstCellCol: Cardinal read FYFirstCellCol write SetYFirstCellCol default 0; - property YFirstCellRow: Cardinal read FYFirstCellRow write SetYFirstCellRow default 0; - property XSelectionDirection: TsSelectionDirection read FXSelectionDirection write SetXSelectionDirection; - property YSelectionDirection: TsSelectionDirection read FYSelectionDirection write SetYSelectionDirection; - end deprecated 'Use TsWorkBOOKChartSource instead of TsWorkSHEETChartSource.'; - - { TsWorkbookChartSource } TsXYLRange = (rngX, rngY, rngLabel); @@ -122,183 +78,11 @@ type end; -//procedure Register; - - implementation uses Math; -{ -procedure Register; -begin - RegisterComponents('Chart', [TsWorksheetChartSource, TsWorkbookChartSource]); -end; -} - -{ TsWorksheetChartSource } - -procedure TsWorksheetChartSource.SetPointsNumber(const AValue: Integer); -begin - if FPointsNumber = AValue then exit; - FPointsNumber := AValue; - InvalidateCaches; - Notify; -end; - -procedure TsWorksheetChartSource.SetXSelectionDirection( - const AValue: TsSelectionDirection); -begin - if FXSelectionDirection=AValue then exit; - FXSelectionDirection:=AValue; - InvalidateCaches; - Notify; -end; - -procedure TsWorksheetChartSource.SetYSelectionDirection( - const AValue: TsSelectionDirection); -begin - if FYSelectionDirection=AValue then exit; - FYSelectionDirection:=AValue; - InvalidateCaches; - Notify; -end; - -procedure TsWorksheetChartSource.SetXFirstCellCol(const AValue: Cardinal); -begin - if FXFirstCellCol=AValue then exit; - FXFirstCellCol:=AValue; - InvalidateCaches; - Notify; -end; - -procedure TsWorksheetChartSource.SetXFirstCellRow(const AValue: Cardinal); -begin - if FXFirstCellRow=AValue then exit; - FXFirstCellRow:=AValue; - InvalidateCaches; - Notify; -end; - -procedure TsWorksheetChartSource.SetYFirstCellCol(const AValue: Cardinal); -begin - if FYFirstCellCol=AValue then exit; - FYFirstCellCol:=AValue; - InvalidateCaches; - Notify; -end; - -procedure TsWorksheetChartSource.SetYFirstCellRow(const AValue: Cardinal); -begin - if FYFirstCellRow=AValue then exit; - FYFirstCellRow:=AValue; - InvalidateCaches; - Notify; -end; - -function TsWorksheetChartSource.GetCount: Integer; -begin - Result := FPointsNumber; -end; - -function TsWorksheetChartSource.GetItem(AIndex: Integer): PChartDataItem; -var - XRow, XCol, YRow, YCol: Integer; - cell: PCell; -begin - // First calculate the cell position - if XSelectionDirection = fpsVerticalSelection then - begin - XRow := Integer(FXFirstCellRow) + AIndex; - XCol := FXFirstCellCol; - end - else - begin - XRow := FXFirstCellRow; - XCol := Integer(FXFirstCellCol) + AIndex; - end; - - if YSelectionDirection = fpsVerticalSelection then - begin - YRow := Integer(FYFirstCellRow) + AIndex; - YCol := FYFirstCellCol; - end - else - begin - YRow := FYFirstCellRow; - YCol := Integer(FYFirstCellCol) + AIndex; - end; - - cell := FDataWorksheet.FindCell(XRow, XCol); - if cell = nil then - begin - FCurItem.X := NaN; - FCurITem.Text := ''; - end else - if cell^.ContentType = cctUTF8String then begin - FCurItem.X := AIndex; - FCurItem.Text := FDataWorksheet.ReadAsText(cell); - end else - begin - FCurItem.X := FDataWorksheet.ReadAsNumber(cell); - FCurItem.Text := ''; - end; - - cell := FDataWorksheet.FindCell(YRow, YCol); - if cell = nil then - FCurItem.Y := NaN - else - FCurItem.Y := FDataWorksheet.ReadAsNumber(cell); - - FCurItem.Color := clDefault; - - Result := @FCurItem; -end; - -constructor TsWorksheetChartSource.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - FInternalWorksheet := TsWorksheet.Create; - FDataWorksheet := FInternalWorksheet; -end; - -destructor TsWorksheetChartSource.Destroy; -begin - if FInternalWorksheet <> nil then FInternalWorksheet.Free; - inherited Destroy; -end; - -procedure TsWorksheetChartSource.LoadFromWorksheetGrid(const AValue: TsWorksheetGrid); -begin - if AValue = nil then Exit; - - FDataWorksheet := AValue.Worksheet; -// AValue.SaveToWorksheet(FDataWorksheet); - - InvalidateCaches; - Notify; -end; - -procedure TsWorksheetChartSource.LoadPropertiesFromStrings(AXInterval, - AYInterval, AXTitle, AYTitle, ATitle: string); -var - lXCount, lYCount: Cardinal; -begin - Unused(AXTitle, AYTitle, ATitle); - ParseIntervalString(AXInterval, FXFirstCellRow, FXFirstCellCol, lXCount, FXSelectionDirection); - ParseIntervalString(AYInterval, FYFirstCellRow, FYFirstCellCol, lYCount, FYSelectionDirection); - if lXCount <> lYCount then raise Exception.Create( - 'TsWorksheetChartSource.LoadPropertiesFromStrings: Interval sizes don''t match'); - FPointsNumber := lXCount; -end; - -procedure TsWorksheetChartSource.SetYCount(AValue: Cardinal); -begin - FYCount := AValue; -end; - - {------------------------------------------------------------------------------} { TsWorkbookChartSource } {------------------------------------------------------------------------------} diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas index ae5e79b01..599ac170e 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas @@ -1,5 +1,5 @@ {@@ ---------------------------------------------------------------------------- - Unit fpspreadsheet implements a **grid** component which can load and + Unit fpSpreadsheetGrid implements a **grid** component which can load and write data from/to FPSpreadsheet documents. Can either be used alone or in combination with a TsWorkbookSource component.