problem with SaveToChartFile and LoadFromChartFile

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Cogito
Newbie
Newbie
Posts: 17
Joined: Fri Feb 06, 2009 12:00 am

problem with SaveToChartFile and LoadFromChartFile

Post by Cogito » Thu May 28, 2009 1:10 pm

Hello,

I use a DBChart which is bound to a datasource. After doing changes from the user the settings are saved with the SaveChartToFile method. After the call of LoadChartFromFile the settings are ok, but no data are shown... What's wrong here?

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

Post by Yeray » Thu May 28, 2009 1:52 pm

Hi Cogito,

Have you called the function with the correct IncludeData parameter? Here it is the function definition:
procedure SaveChartToFile(AChart: TCustomChart; Const AFileName: String; IncludeData, TextFormat: Boolean);

Unit
TeeStore

Description
This method will save the current chart as a TeeChart 'tee' template to the specified File Name.
Tee templates are an efficient way to save runtime Chart appearance and may be loaded at runtime using the LoadChartFromFile.

The IncludeData parameter determines if Series point values are stored or not together with the template definition.

This includes Series point values, colors and text labels.
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

Cogito
Newbie
Newbie
Posts: 17
Joined: Fri Feb 06, 2009 12:00 am

Post by Cogito » Thu May 28, 2009 3:27 pm

9348257 wrote:Hi Cogito,

Have you called the function with the correct IncludeData parameter? Here it is the function definition:
procedure SaveChartToFile(AChart: TCustomChart; Const AFileName: String; IncludeData, TextFormat: Boolean);

Unit
TeeStore

Description
This method will save the current chart as a TeeChart 'tee' template to the specified File Name.
Tee templates are an efficient way to save runtime Chart appearance and may be loaded at runtime using the LoadChartFromFile.

The IncludeData parameter determines if Series point values are stored or not together with the template definition.

This includes Series point values, colors and text labels.
Yes, I've used it with and without include data, but nothing happens. Also the AutoRefresh Parameter is set to true, but no data were shown???

----------------------------------------------------------------------------
OK, problem solved. I have to manually trigger a datarefresh after the loading of chartfile settings! (why is there an autorefresh parameter?

In this context another question:

I use also a bar chart and want to show the values above the bars in a localized manner, for example:

the value 4,58 should be shown in USA as 4.58, because there is another decimal separator. Therefore I want to use the format function in delphi, but I don't know in which event I should do it (OnGetAxisLabel?). Can you give me a sample how to do that?

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

Post by Yeray » Fri May 29, 2009 8:44 am

Hi Cogito,

Could you please try this example?

At design time:
- Drop a Chart (Chart1) on the top-left corner of your form.
- Drop a Panel on the right side.
- Drop a Chart (Chart2) inside this new Panel, on the top-left corner of this panel.
- Drop a button on your form.

Here is this example code:

Code: Select all

uses Series, TeeAntiAlias, TeeStore, TeeEditPro;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D := false;

  for i:=0 to 3 do
  begin
    Chart1.AddSeries(TLineSeries.Create(self));
    Chart1[i].FillSampleValues(25);
  end;

  Chart1.Tools.Add(TAntiAliasTool.Create(self));
end;

procedure TForm1.Button1Click(Sender: TObject);
var tmpChart: TCustomChart;
begin
  SaveChartToFile(Chart1,'c:\myteefile.tee', true, true);

  tmpChart := TChart.Create(self);
  LoadChartFromFile(TCustomChart(Chart2), 'c:\myteefile.tee');
end;


Regarding the decimal separator issue, please see my reply here
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