Export (0) Print
Expand All

ChartSerializer Class

Enables serialization of the Chart control.

System.Object
  System.Web.UI.DataVisualization.Charting.ChartSerializer

Namespace:  System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)

type ChartSerializer =  class end

The ChartSerializer type exposes the following members.

  NameDescription
Public propertyContentGets or sets the type of chart content to be serialized.
Public propertyFormatGets or sets the format used when the chart is serialized.
Public propertyIsResetWhenLoadingGets or sets a flag that indicates whether object properties are reset to default values before loading.
Public propertyIsTemplateModeGets or sets a flag that indicates whether the chart serializer is working in template-creation mode.
Public propertyIsUnknownAttributeIgnoredGets or sets a flag that indicates whether unknown XML properties and elements will be ignored without throwing an exception.
Public propertyNonSerializableContentGets or sets the chart properties that will not be serialized.
Public propertySerializableContentGets or sets the chart properties that can be serialized.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected methodGetContentStringReturns a serializable or non serializable class and/or property names, depending on the specific flag value.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodLoad(Stream)Loads serialized data into the control from an object derived from the Stream class.
Public methodLoad(String)Loads serialized data saved to disk into the Chart control.
Public methodLoad(TextReader)Loads serialized data into the control from a reader object that derives from the TextReader class.
Public methodLoad(XmlReader)Loads serialized data into the control from an object derived from the XmlReader class.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodResetResets all chart properties marked for serialization.
Public methodSave(Stream)Saves chart data and properties with non-default values to an object that derives from the Stream class.
Public methodSave(String)Saves chart data and properties with non-default values to the given file.
Public methodSave(TextWriter)Saves chart data and properties with non-default values to the given object that is derived from the TextWriter class.
Public methodSave(XmlWriter)Saves chart data and properties with non-default values to the given object that is derived from the XmlWriter class.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

This class is exposed as the Serializer property of the root Chart class.

Serialization saves the state of the chart and also provides the option to load the serialized data into the chart. All chart properties can be persisted, including the chart's data. In addition, all chart properties marked for serialization can be reset.

This class can optionally be used when managing user-defined view state. One of its Load methods can be used to load the view state, and one of the Save methods can be used when setting the view state.

The XML or binary formats can be used to store serialized data. XML is used by default, but you can change the format with the Format property.

Chart properties are saved and loaded using the Save and Load methods, respectively. Note that only properties with non-default values will be saved. Data can be saved and/or loaded using a file, stream, TextWriter, TextReader, XmlWriter and XmlReader objects. When saving and/or loading data using an object derived from the TextReader, TextWriter, XmlReader or XmlWriter classes, the format of the data must be XML.

The following list describes three techniques, from basic to advanced, used to define serializable data. Note that it is also possible to define non-serializable data. This technique is described in the next paragraph.

  • Serialize the Chart using the Save and Load methods, without specifying any serializable properties. All chart properties with non-default values, which includes chart data, will be serialized.

  • Serialize the chart properties specified by the Content property. The Content property groups the chart properties to be serialized into categories such as Data, Appearance, and so forth. Note that the names of ChartArea and Series objects are automatically serialized; the serialized data is then applied to existing chart areas and series when loaded.

Important noteImportant

The Content property is implemented internally by the Chart control as the SerializableContent property

  • Serialization of chart properties specified by the SerializableContent property. This is a comma-separated listing of all chart properties that are serializable. After this property is set to an explicit value, it is the responsibility of the developer to specify all properties to be saved. In other words, unlike the Content property, the names of chart areas and series will not be automatically persisted. The Content and SerializableContent properties can also be used in conjunction. However, make sure that SerializableContent is concatenated with itself when being set, otherwise the chart properties specified by the Content property will be overridden.

To prohibit certain properties from being serialized, use the NonSerializableContent property. When one property is set as serializable and non-serializable, which is common when wildcards are used, the SerializableContent property has precedence. However, precedence also depends on how many wildcards were used when a property was specified.

By default, serializable properties are reset to their defaults before they are loaded. This behavior can be changed using the IsResetWhenLoading property. The Reset method can also be used to explicitly reset chart properties to their default values.

.NET Framework

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft