home *** CD-ROM | disk | FTP | other *** search
- unit Template_Chart;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Base, StdCtrls, ExtCtrls, TeeProcs, TeEngine, Chart, ActnList,
- TeeChartActions;
-
- type
- TTemplateChart = class(TBaseForm)
- TemplateChart: TChart;
- Button1: TButton;
- Button2: TButton;
- ActionList1: TActionList;
- ChartActionEdit1: TChartActionEdit;
- Splitter1: TSplitter;
- procedure Button2Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- implementation
-
- {$R *.DFM}
- Uses TeeStore;
-
- procedure TTemplateChart.Button2Click(Sender: TObject);
- var tmp : TMemoryStream;
- begin
- { 1) Save the template into a Stream... }
- tmp:=TMemoryStream.Create;
- try
- { save only Chart and Series formatting, not data }
- SaveChartToStream(TemplateChart,tmp,False);
-
- { 2) Load the template... }
- LoadChartFromStream(TCustomChart(Chart1),tmp);
-
- { restore the chart alignment (in this example) }
- Chart1.Align:=alClient;
-
- { repaint the Chart }
- Chart1.Repaint;
- finally
- { remove the stream, it's no longer necessary... }
- tmp.Free;
- end;
- end;
-
- procedure TTemplateChart.FormCreate(Sender: TObject);
- begin
- inherited;
- { global variable, to add random points at runtime }
- TeeRandomAtRunTime:=True;
- end;
-
- initialization
- RegisterClass(TTemplateChart);
- end.
-