ComponentOne Chart for .NET (2.0) Search HelpCentral 

Loading and Saving Chart Data

To save the chart’s data to XML at design time, right-click on the chart control.  This will bring up the chart’s context menu.  Conveniently provided on the context menu are the SaveDataToFile and LoadDataFromFile methods of the ChartData object.

To save just the chart’s data to XML, call the SaveDataToFile method, which takes the file’s path as a parameter:

·      Visual Basic

C1Chart1.ChartGroups.Group0.ChartData_

   .SaveDataToFile("C:\ComponentOneDocs\chartdata1.xml")

·      C#

C1Chart1.ChartGroups.Group0.ChartData

   .SaveDataToFile("C:\\ComponentOneDocs\\chartdata1.xml");

·      Delphi

begin

   C1Chart1.ChartGroups.Group0.ChartData

     .SaveDataToFile('C:\\ComponentOneDocs\\chartdata1.xml');

end;

To load the chart’s data back from XML, call the LoadDataFromFile method, which takes the file’s path as a parameter:

·      Visual Basic

C1Chart1.ChartGroups.Group0.ChartData_

   .LoadDataFromFile("C:\ComponentOneDocs\chartdata1.xml")

·      C#

C1Chart1.ChartGroups.Group0.ChartData

   .LoadDataFromFile("C:\\ComponentOneDocs\\chartdata1.xml");

·      Delphi

begin

   Chart1.ChartGroups.Group0.ChartData

      .LoadDataFromFile('C:\\ComponentOneDocs\\chartdata1.xml');

end;

An in-depth discussion of the structure of the XML file is not covered here, but the file can be opened as a text file and easily dissected.  


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.