From 30246e26583e9751951c640b43f8e68fdf533d3a Mon Sep 17 00:00:00 2001 From: ask Date: Wed, 20 Apr 2011 10:49:17 +0000 Subject: [PATCH] TAChart: Add fpvectorial demo git-svn-id: trunk@30399 - --- .gitattributes | 4 + .gitignore | 3 + components/tachart/demo/fpvectorial/Main.lfm | 66 +++++++++++ components/tachart/demo/fpvectorial/Main.pas | 51 +++++++++ .../demo/fpvectorial/fpvectorialdemo.lpi | 104 ++++++++++++++++++ .../demo/fpvectorial/fpvectorialdemo.lpr | 21 ++++ 6 files changed, 249 insertions(+) create mode 100644 components/tachart/demo/fpvectorial/Main.lfm create mode 100644 components/tachart/demo/fpvectorial/Main.pas create mode 100644 components/tachart/demo/fpvectorial/fpvectorialdemo.lpi create mode 100644 components/tachart/demo/fpvectorial/fpvectorialdemo.lpr diff --git a/.gitattributes b/.gitattributes index 220dbf9549..9d883603ad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2370,6 +2370,10 @@ components/tachart/demo/extent/extentdemo.lpi svneol=native#text/plain components/tachart/demo/extent/extentdemo.lpr svneol=native#text/plain components/tachart/demo/extent/main.lfm svneol=native#text/plain components/tachart/demo/extent/main.pas svneol=native#text/plain +components/tachart/demo/fpvectorial/Main.lfm svneol=native#text/plain +components/tachart/demo/fpvectorial/Main.pas svneol=native#text/pascal +components/tachart/demo/fpvectorial/fpvectorialdemo.lpi svneol=native#text/plain +components/tachart/demo/fpvectorial/fpvectorialdemo.lpr svneol=native#text/pascal components/tachart/demo/func/funcdemo.lpi svneol=native#text/plain components/tachart/demo/func/funcdemo.lpr svneol=native#text/plain components/tachart/demo/func/main.lfm svneol=native#text/plain diff --git a/.gitignore b/.gitignore index 0f6eb2ac2c..31ee7c7ef6 100644 --- a/.gitignore +++ b/.gitignore @@ -166,6 +166,9 @@ components/tachart/demo/events/lib components/tachart/demo/extent/*.exe components/tachart/demo/extent/*.lps components/tachart/demo/extent/lib +components/tachart/demo/fpvectorial/*.exe +components/tachart/demo/fpvectorial/*.lps +components/tachart/demo/fpvectorial/lib components/tachart/demo/func/*.exe components/tachart/demo/func/*.lps components/tachart/demo/func/lib diff --git a/components/tachart/demo/fpvectorial/Main.lfm b/components/tachart/demo/fpvectorial/Main.lfm new file mode 100644 index 0000000000..fcaf88b68c --- /dev/null +++ b/components/tachart/demo/fpvectorial/Main.lfm @@ -0,0 +1,66 @@ +object Form1: TForm1 + Left = 1373 + Height = 342 + Top = 164 + Width = 422 + Caption = 'Form1' + ClientHeight = 342 + ClientWidth = 422 + Position = poScreenCenter + LCLVersion = '0.9.31' + object Chart1: TChart + Left = 0 + Height = 300 + Top = 42 + Width = 422 + AxisList = < + item + Title.LabelFont.Orientation = 900 + end + item + Alignment = calBottom + end> + Foot.Brush.Color = clBtnFace + Foot.Font.Color = clBlue + Title.Brush.Color = clBtnFace + Title.Font.Color = clBlue + Title.Text.Strings = ( + 'TAChart' + ) + Align = alClient + ParentColor = False + object Chart1LineSeries1: TLineSeries + LinePen.Color = clFuchsia + Source = RandomChartSource1 + end + end + object Panel1: TPanel + Left = 0 + Height = 42 + Top = 0 + Width = 422 + Align = alTop + ClientHeight = 42 + ClientWidth = 422 + TabOrder = 1 + object Button1: TButton + Left = 8 + Height = 25 + Top = 8 + Width = 75 + Caption = 'Button1' + OnClick = Button1Click + TabOrder = 0 + end + end + object RandomChartSource1: TRandomChartSource + PointsNumber = 11 + RandSeed = 1335683875 + XMax = 1 + XMin = -1 + YMax = 100 + YMin = -100 + left = 68 + top = 156 + end +end diff --git a/components/tachart/demo/fpvectorial/Main.pas b/components/tachart/demo/fpvectorial/Main.pas new file mode 100644 index 0000000000..08e4cada75 --- /dev/null +++ b/components/tachart/demo/fpvectorial/Main.pas @@ -0,0 +1,51 @@ +// NOTE: This is very experimental code. Do not expect it to work! + +unit Main; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, ExtCtrls, StdCtrls, SysUtils, FileUtil, Forms, Controls, Graphics, + Dialogs, TAGraph, TASeries, TASources; + +type + + { TForm1 } + + TForm1 = class(TForm) + Button1: TButton; + Chart1: TChart; + Chart1LineSeries1: TLineSeries; + Panel1: TPanel; + RandomChartSource1: TRandomChartSource; + procedure Button1Click(Sender: TObject); + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +uses + FPVectorial, SVGVectorialWriter, TADrawerFPVectorial; + +{ TForm1 } + +procedure TForm1.Button1Click(Sender: TObject); +var + d: TvVectorialDocument; +begin + d := TvVectorialDocument.Create; + d.Width := Chart1.Width; + d.Height := Chart1.Height; + with Chart1 do + Draw(TFPVectorialDrawer.Create(d), Rect(0, 0, Width, Height)); + d.WriteToFile('test.svg', vfSVG); +end; + +end. + diff --git a/components/tachart/demo/fpvectorial/fpvectorialdemo.lpi b/components/tachart/demo/fpvectorial/fpvectorialdemo.lpi new file mode 100644 index 0000000000..bba0c0f4a9 --- /dev/null +++ b/components/tachart/demo/fpvectorial/fpvectorialdemo.lpi @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/tachart/demo/fpvectorial/fpvectorialdemo.lpr b/components/tachart/demo/fpvectorial/fpvectorialdemo.lpr new file mode 100644 index 0000000000..8040c4ffb5 --- /dev/null +++ b/components/tachart/demo/fpvectorial/fpvectorialdemo.lpr @@ -0,0 +1,21 @@ +program fpvectorialdemo; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + fpvectorialpkg, Interfaces, // this includes the LCL widgetset + Forms, Main, tachartfpvectorial, tachartlazaruspkg + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource := True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. +