Page 1 of 1

Saving Chart Specification 5.02/Delphi 6

Posted: Tue Mar 14, 2006 1:44 pm
by 5892278
Is there a way to save the specification of a chart (Datasource, series, Titles etc) rather than the whole chart?

many thanks

Posted: Tue Mar 14, 2006 2:40 pm
by narcis
Hi tcardinal,

First of all, please notice that TeeChart native files (.tee) don't save series datasources. Having that in mind, you may export series styles (line, bar, points, etc.), data and titles using XML exporting.

Also notice that .tee files only store those settings which have been changed in a default chart so no much data is stored on them.

Posted: Wed Mar 15, 2006 1:25 pm
by 5892278
Many thanks NarcĂ­s

I have found the SaveToStream and LoadFromStream in the TeeStore unit.

However, I need to save these to an XML document but the .tee format contains characters not allowed in XML. As a result I get an error when I try to write to my XML document.

Is there another format I can save to? If so where would I find the function?

many thanks

Posted: Wed Mar 15, 2006 2:02 pm
by narcis
Hi tcardinal,

To store a TeeChart into a XML file you need to do something like this:

Code: Select all

Procedure TExportXMLForm.ShowSavedFile;
begin
  GoToURL(Handle,SaveDialog1.FileName);
end;

procedure TExportXMLForm.Button1Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
  begin
   { nil = all series in Chart1 }
    with TSeriesDataXML.Create(Chart1,nil) do
    try
      IncludeIndex:=CheckBox1.Checked;

      SaveToFile(SaveDialog1.FileName);
      ShowSavedFile;
    finally
      Free;
    end;
  end;
end;