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


stream

An object derived from the Stream class (e.g. MemoryStream) used to save chart properties.


The stream where to save the data.

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


Saves all properties of the chart into the stream. By setting Content or SerializableContent/NonSerializableContent properties specific set of properties can be saved.

Syntax

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

Parameters

stream

An object derived from the Stream class (e.g. MemoryStream) used to save chart properties.


The stream where to save the data.

Example

The following example first serializes all appearance data to a memory stream (only properties with non-default values), and then loads the serialized data. Axis labels are also serialized.

Visual Basic Copy Code
' Create MemoryStream object
Dim myStream As New MemoryStream()

' 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(myStream)
...

' Load the serialized data
Chart1.Serializer.Content = SerializationContent.Appearance
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name"
Chart1.Serializer.Load (myStream)
C# Copy Code
// Create MemoryStream object
MemoryStream myStream = new System.IO.MemoryStream();

// 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 (myStream);
...

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

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 ContentSerializableContent and NonSerializableContent properties.

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.

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.