In addition to loading and saving to an XML file, the chart has the ability to save to a string value. This string can then be saved in an application and retrieved at a future time.
C1Chart provides four methods for loading and saving chart to a string: SaveChartToString, LoadChartFromString, SaveChartAndImagesToString, and LoadChartAndImagesFromString.
The SaveChartToString and LoadChartFromString methods enable you to save a copy of the chart to a string value in the application. This string value contains all the set properties, methods, and events for the chart, in essence, its formatting. The chart can save to this file, and then if the structure remains intact, load a chart from this file.
The SaveChartAndImagesToString and LoadChartAndImagesFromString methods does the same as the SaveChartToString and LoadChartFromString methods except that they capture the various background images of the chart elements (chart, header, footer, labels).To save the chart to a string at run time, call the SaveChartToString method, this takes no parameters and returns the string value:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim ChartString As String ChartString = C1Chart1.SaveChartToString() |
To write code in C#
C# |
Copy Code
|
---|---|
string ChartString; ChartString = c1Chart1.SaveChartToString(); |
To load the chart from a string value at run time, call the LoadChartFromString method, which takes the saved chart string as its only parameter:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
C1Chart1.LoadChartFromString(ChartString) |
To write code in C#
C# |
Copy Code
|
---|---|
c1Chart1.LoadChartFromString(ChartString); |