Loading and Saving Chart to a File

In C1Chart, each chart can be loaded from and saved to an external XML file using the Save Chart/Load Chart commands from C1Chart’s context menu at design-time or programmatically using any of the following methods:

      LoadChartFromFile

      SaveChartToFile

      LoadChartAndImagesFromFile

      SaveChartAndImagesToFile

The SaveChartAndImagesToFile and LoadChartAndImagesFromFile methods does the same as the SaveChartToFile and LoadChartFromFile methods except that they capture the various background images of the chart elements (chart, header, footer, labels).

If you only want to save the chart’s data you can do so using 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

      C#

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

      Visual Basic

      C#

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 us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.