Page 1 of 1

Problems using Load-/SaveChartToFile with TMapSeries

Posted: Wed Jun 28, 2006 11:10 am
by 9232649
Hi,

I have created a TMapSeries with some polygons, in this test case a square, what I would like to do is to save the chart with the TMapSeries and its corresponding polygon to file and then load it again. What seems to occur is that the TMapSeries is there but the polygon points doesnt appear after LoadChartFromFile. See the test code below:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, TeCanvas,
Dialogs, StdCtrls, ExtCtrls, TeeProcs, TeEngine, Chart, Series, TeeStore, TeeMapSeries;

type
TForm1 = class(TForm)
Chart1: TChart;
btnCreate: TButton;
btnLoad: TButton;
procedure btnCreateClick(Sender: TObject);
procedure btnLoadClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnCreateClick(Sender: TObject);
var
ASerie: TMapSeries;
APol: TTeePolygon;
i: integer;
begin
ASerie:=TMapSeries.Create(Chart1);
ASerie.ParentChart:=Chart1;
APol:=ASerie.Shapes.Add;
with APol.Points do
begin
AddXY(1,1);
AddXY(1,10);
AddXY(10,10);
AddXY(10,1);
end;
SaveChartToFile(Chart1,'C:\test.tee');

end;

procedure TForm1.btnLoadClick(Sender: TObject);
var tmpChart:TCustomChart;
begin
Chart1.Free; //assuming Chart1 is already on the Form
tmpChart:=TChart.Create(Self);
LoadChartfromFile(tmpChart,'c:\test.tee');
Chart1 := tmpChart as TChart;
Chart1.Parent:=Self;

end;

end.

If anyone has any idea how to make this work I would be grateful.

Best Regards,

Johan Ingemansson

Posted: Fri Jun 30, 2006 9:31 am
by narcis
Hi Johan,

Yes, this is a problem we are aware of and is on our wish-list to be enhanced for future releases. For now you need to do it manually as in the TeeMaps demo included with TeeChart binary installers at, for example: C:\Program Files\Steema Software\TeeChart 7.08 for Delphi 2006\Examples\TeeMaps.