Redigera

Dela via


ChartSerializer.Save Method

Definition

Saves chart properties that have non-default values. All chart properties can be serialized; this includes data.

Overloads

Save(XmlWriter)

Saves chart data and properties with non-default values to the given object that is derived from the XmlWriter class.

Save(Stream)

Saves chart data and properties with non-default values to an object that derives from the Stream class.

Save(TextWriter)

Saves chart data and properties with non-default values to the given object that is derived from the TextWriter class.

Save(String)

Saves chart data and properties with non-default values to the given file.

Save(XmlWriter)

Saves chart data and properties with non-default values to the given object that is derived from the XmlWriter class.

public:
 void Save(System::Xml::XmlWriter ^ writer);
public void Save (System.Xml.XmlWriter writer);
member this.Save : System.Xml.XmlWriter -> unit
Public Sub Save (writer As XmlWriter)

Parameters

writer
XmlWriter

An object derived from XmlWriter used to save Chart properties.

Remarks

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

When you use this definition, the format must be XML; the format can be changed with the Format property.

When you work with XML format text files, for simplicity use the Save method instead.

Applies to

Save(Stream)

Saves chart data and properties with non-default values to an object that derives from the Stream class.

public:
 void Save(System::IO::Stream ^ stream);
public void Save (System.IO.Stream stream);
member this.Save : System.IO.Stream -> unit
Public Sub Save (stream As Stream)

Parameters

stream
Stream

An object derived from the Stream class, such as MemoryStream, that is used to save chart properties.

Remarks

By default, all chart properties with non-default values, which 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.

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

Serialization of a chart as a template occurs differently from non-template serialization; template serialization concentrates on Appearance properties.

When a template is serialized, the LoadTemplate method can be used to load the template, to provide the Appearance properties for a chart.

Templates can be used to simulate custom palettes.

Applies to

Save(TextWriter)

Saves chart data and properties with non-default values to the given object that is derived from the TextWriter class.

public:
 void Save(System::IO::TextWriter ^ writer);
public void Save (System.IO.TextWriter writer);
member this.Save : System.IO.TextWriter -> unit
Public Sub Save (writer As TextWriter)

Parameters

writer
TextWriter

An object derived from TextWriter class, for example, StringWriter, that is used to save chart properties.

Remarks

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

When you use this definition, the format must be XML; the format can be set with the Format property.

If the ViewStateData property of the Chart control is used to persist state, this method can be used to save the serialized data to an object derived from TextWriter, which is then used to write the data to the ViewStateData property.

Applies to

Save(String)

Saves chart data and properties with non-default values to the given file.

public:
 void Save(System::String ^ fileName);
public void Save (string fileName);
member this.Save : string -> unit
Public Sub Save (fileName As String)

Parameters

fileName
String

The relative or absolute path of the file used to store the serialized data. Note that if a relative path is specified, the path will be relative to the current directory.

Remarks

By default all chart properties with non-default values, which 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.

Note that Write permissions must be enabled for the directory in which the file is stored. By default, this is the Bin folder of the application.

If this method is being used to save Appearance properties as a template, make sure that the IsTemplateMode property is first set to true before calling this method.

Serialization of a chart as a template proceeds differently from non-template serialization, primarily because template serialization concentrates on Appearance properties.

When a template is serialized, the LoadTemplate method can be used to load the template, to provide the Appearance properties for a chart.

Templates can be used to simulate custom palettes.

Applies to