Don't TeeStore.SaveChartToFile save all property-value ?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
weichangmei
Newbie
Newbie
Posts: 12
Joined: Thu Jun 06, 2013 12:00 am

Don't TeeStore.SaveChartToFile save all property-value ?

Post by weichangmei » Sun Aug 25, 2013 5:49 am

hi, i want to save chart's property-value by TeeStore.SaveChartToFile and restore property-value by TeeStore.LoadChartFromFile,
but, Only some property-value are stored.

+++++++++ My Test Step begin ++++++++
Step 1: Run the program, the title's visible is true, and the legend's visible is true.
Step 2: Save the chart to file "c:\1.tee"
Step 3: Change title's visible to false
Step 4: Change legend's visible to false
Step 5: Load chart from file "c:\1.tee"

Now the title's visible is still false, and the legend's visible still false.
------------- My Test Step end --------------

My question is :
1) How to save and restore all property-value of chart?
2) if TeeStore don't support to save and restore all property-value of chart, please give me a list of which properties are not saved.

+++++++++ My program begin ++++++++++
unit Main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, TeeProcs, TeeGalleryPanel, TeeGDIPlus, StdCtrls, TeEngine,
Chart, DBChart, TeeEdit, ComCtrls, Series, DB, DBTables, TeeChineseSimp,
TeeTranslate, TeeDBSumEdit, TeeDBSourceEditor, DBEditCh, TeeDBCrossTab,
TeeExcelSource, TeeSeriesTextEd, TeeXML, TeeDBEdit, TeeSourceEdit, TeeStore;

type
TForm1 = class(TForm)
ChartEditor1: TChartEditor;
Panel1: TPanel;
btnEdit: TButton;
DBChart1: TDBChart;
Series1: TLineSeries;
btnSave: TButton;
btnLoad: TButton;
SaveDialog1: TSaveDialog;
OpenDialog1: TOpenDialog;
procedure btnEditClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure btnSaveClick(Sender: TObject);
procedure btnLoadClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnSaveClick(Sender: TObject);
begin
if SaveDialog1.Execute then
SaveChartToFile(DBChart1, SaveDialog1.FileName, False, True);
end;

procedure TForm1.btnLoadClick(Sender: TObject);
begin
if OpenDialog1.Execute then
LoadChartFromFile(TCustomChart(DBChart1), OpenDialog1.FileName);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
TeeSetChineseSimp;
TeeTranslateControl(Form1);
end;

procedure TForm1.btnEditClick(Sender: TObject);
begin
ChartEditor1.Execute;
end;

end.

-------------- My program End -------------
Attachments
00 AboutSave.png
00 AboutSave.png (186.42 KiB) Viewed 3392 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Don't TeeStore.SaveChartToFile save all property-value ?

Post by Yeray » Tue Aug 27, 2013 3:22 pm

Hello,

This is because, when you load the tee file, you are loading it over a chart with a hidden legend and title instead of over an "empty" chart.
Note that the tee file only stores those properties that don't have the default value. This produces smaller tee files, but needs empty charts to load the tee files, just as in the Tutorial 12. Ie:

Code: Select all

procedure TForm1.btnLoadClick(Sender: TObject);
var tmpChart : TCustomChart;
begin
  DBChart1.Free;
  tmpChart:=TDBChart.Create(Self);

  With OpenDialog1 do
  begin
    Filter:= 'Teefiles|*.tee';
    if Execute then 
       LoadChartfromFile(tmpChart, OpenDialog1.FileName);
  end;

  DBChart1:=tmpChart as TDBChart;
  DBChart1.Parent:=Self;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply