You can load or save the Chart control to or from an XML file. This option is available at design time if you select the Chart control on the form and select the chart verb. Select the Save to XML or Load from XML menu option. Use the LoadFromTemplate or SaveToTemplate methods at run time.
Return to Using the Chart Control.
Using Code
Save or load a Chart control to an XML file.
Example
The following example saves or loads a Chart control.
C# | Copy Code |
---|---|
string f; f = "c:\\chart.xml"; System.IO.FileStream s = new System.IO.FileStream(f, IO.FileMode.OpenorCreate, IO.FileAccess.ReadWrite); FpChart1.SaveToTemplate(s); //FpChart1.LoadFromTemplate(s); |
VB | Copy Code |
---|---|
Dim f As String f = "c:\chart.xml" Dim s As New System.IO.FileStream(f, IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite) FpChart1.SaveToTemplate(s) 'FpChart1.LoadFromTemplate(s) |