Page 1 of 1

problem with SaveToChartFile and LoadFromChartFile

Posted: Thu May 28, 2009 1:10 pm
by 10051657
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?

Posted: Thu May 28, 2009 1:52 pm
by yeray
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.

Posted: Thu May 28, 2009 3:27 pm
by 10051657
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?

Posted: Fri May 29, 2009 8:44 am
by yeray
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