Dundas Chart for ASP.NET
Save(String) Method
See Also  Example Send comments on this topic.
Dundas.Charting.WebControl Namespace > ChartSerializer Class > Save Method : Save(String) Method


fileName
Relative or absolute pathname of the file used to store the serialized data. To specify a URL use a Server.MapPath statement.  Also note that if a relative pathname is used that the pathname will be relative to the current directory.
The file name used to write the data.
Saves chart data and properties with non-default values to the given file.
Saves all properties of the chart into the file. By setting Content or SerializableContent/NonSerializableContent properties specific set of properties can be saved.

Syntax

Visual Basic (Declaration)  
Public Overloads Sub Save( _
   ByVal fileName As String _
) 
Visual Basic (Usage) Copy Code
Dim instance As ChartSerializer
Dim fileName As String
 
instance.Save(fileName)
C#  
public void Save( 
   string fileName
)

Parameters

fileName
Relative or absolute pathname of the file used to store the serialized data. To specify a URL use a Server.MapPath statement.  Also note that if a relative pathname is used that the pathname will be relative to the current directory.
The file name used to write the data.

Example

The following example first serializes all appearance data to disk (only properties with non-default values), and then loads the serialized data. Axis labels are also serialized.
Visual Basic Copy Code
' Save chart appearance properties that have non-default values., as well as axis labels.
Chart1.Serializer.Content = SerializationContent.Appearance

' We can concatenate the Content property string and the SerializableContent string, since the Content
' property is implemented internally as the SerializableContent property. Since we use the
' SerializableContent property we also need to persist the ChartArea and Series object's names,
' otherwise these serialized properties will be applied to new ChartArea and Series objects
' when the data is loaded.
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name"
Chart1.Serializer.Save ("SavedData.xml")
...

' Load the serialized data
Chart1.Serializer.Content = SerializationContent.Appearance
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name"
Chart1.Serializer.Load ("SavedData.xml")
C# Copy Code
// Save chart appearance properties that have non-default values, as well as axis labels.
Chart1.Serializer.Content= SerializationContent.Appearance;

// We can concatenate the Content property string and the SerializableContent string, since the Content
//   property is implemented internally as the SerializableContent property. Since we use the
//   SerializableContent property we also need to persist the ChartArea and Series object's names,
//   otherwise these serialized properties will be applied to new ChartArea and Series objects
//    when the data is loaded.
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name";
Chart1.Serializer.Save (
"SavedData.xml");
...

// Load the serialized data.
Chart1.Serializer.Content = SerializationContent.Appearance;
Chart1.Serializer.SerializableContent +=
",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name";
Chart1.Serializer.Load (
"SavedData.xml");

Remarks

By default all chart properties with non-default values (this includes data points) will be serialized when this method is called. To control chart characteristics to be serialized use the Content, SerializableContent and NonSerializableContent properties.

By default data is saved in an XML format. To save the data in a binary format use the Format property.

Please note that Write permissions must be enabled for the directory the file is stored in (by default the Bin folder of the application).

If this method is being used to save appearance properties as a template then make sure that the TemplateMode property of the ChartSerializer object is first set to true before calling this method.

Serialization of a chart as a template occurs differently then non-template serialization, with template serialization concentrating on appearance properties.  In addition, when a template is serialized it can then be loaded to provide the appearance properties for a chart using the Chart.LoadTemplate method method. 

Templates can be used to simulate custom palettes.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Copyright © 2001 - 2009 Dundas Data Visualization, Inc. and others.