Chart controls can be saved to and loaded from an XML file. This feature is also available from the smart tag of the FpChart control placed on the form.
You can load the XML file with the LoadFromTemplate method of the FpChart class and save it to the XML file with the SaveToTemplate method.
The following sample code saves or loads the chart control into an XML file.
C# |
Copy Code
|
---|---|
string f; f = "c:\\temp\\chart.xml"; System.IO.FileStream s = new System.IO.FileStream(f, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite); fpChart1.SaveToTemplate(s); //fpChart1.LoadFromTemplate(s); |
Visual Basic |
Copy Code
|
---|---|
Dim f As String f = "c:\chart.xml" Dim s As New System.IO.FileStream(f, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite) FpChart1.SaveToTemplate(s) 'FpChart1.LoadFromTemplate(s) |