Question about ver 8 import / export functions
Posted: Tue Sep 18, 2007 3:34 pm
Hello,
We are looking to provide a way to build a chart and export it - both data and all markup settings - to a file. We would then like the ability to reimport this exported information to a TChart object and have a "new" live chart.
We are experimenting with the trial for version 8. I see there are several export functions for Text, XML, HTML, etc. For import, I see there is the ability to import from a *.TEE file.
Please bear with me for this question but can you elaborate on exactly *how* we could accomplish this little task? I created a simple test application consisting of one form with two TChart components. This form has three buttons. The first populates the first TChart with 3 series of sample data, the second exports the contents of Chart1 using SaveChartToFile, and the third tries to populate the second Chart from the export file created by button2.
Here is the source code for my one and only unit...
To import my data, I tried both the LoadChartFromFile method AND the TImportChart class's LoadFromFile method. Both report the same errors, neither can locate the needed Series classes to create my second chart. So where my source chart had three series (one bar, one line, one pie), during Import, I get three error messages "Class TBarSeries not found", "Class TPieSeries not found", and "Class TLineSeries not found".
Can you please tell me what I am doing wrong?
We are looking to provide a way to build a chart and export it - both data and all markup settings - to a file. We would then like the ability to reimport this exported information to a TChart object and have a "new" live chart.
We are experimenting with the trial for version 8. I see there are several export functions for Text, XML, HTML, etc. For import, I see there is the ability to import from a *.TEE file.
Please bear with me for this question but can you elaborate on exactly *how* we could accomplish this little task? I created a simple test application consisting of one form with two TChart components. This form has three buttons. The first populates the first TChart with 3 series of sample data, the second exports the contents of Chart1 using SaveChartToFile, and the third tries to populate the second Chart from the export file created by button2.
Here is the source code for my one and only unit...
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Series, TeEngine, ExtCtrls, TeeProcs, Chart;
type
TForm1 = class(TForm)
btnCreate: TButton;
btnExport: TButton;
Chart1: TChart;
btnImport: TButton;
Chart2: TChart;
procedure btnCreateClick(Sender: TObject);
procedure btnExportClick(Sender: TObject);
procedure btnImportClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses TeeStore;
procedure TForm1.btnCreateClick(Sender: TObject);
begin
Chart1.AddSeries(TPieSeries);
Chart1.AddSeries(TBarSeries);
Chart1.AddSeries(TLineSeries);
Chart1.SeriesList.FillSampleValues(15);
end;
procedure TForm1.btnExportClick(Sender: TObject);
begin
SaveChartToFile(Chart1, 'c:\Export.tee', True);
end;
procedure TForm1.btnImportClick(Sender: TObject);
begin
LoadChartFromFile(TCustomChart(Chart2), 'c:\Export.tee');
end;
end.
Can you please tell me what I am doing wrong?