ChartSerializer Class
TOC
Collapse the table of content
Expand the table of content

ChartSerializer Class

.NET Framework (current version)
 

Enables serialization of the Chart control.

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

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

public class ChartSerializer

NameDescription
System_CAPS_pubpropertyContent

Gets or sets the type of chart content to be serialized.

System_CAPS_pubpropertyFormat

Gets or sets the format used when the chart is serialized.

System_CAPS_pubpropertyIsResetWhenLoading

Gets or sets a flag that indicates whether object properties are reset to default values before loading.

System_CAPS_pubpropertyIsTemplateMode

Gets or sets a flag that indicates whether the chart serializer is working in template-creation mode.

System_CAPS_pubpropertyIsUnknownAttributeIgnored

Gets or sets a flag that indicates whether unknown XML properties and elements will be ignored without throwing an exception.

System_CAPS_pubpropertyNonSerializableContent

Gets or sets the chart properties that will not be serialized.

System_CAPS_pubpropertySerializableContent

Gets or sets the chart properties that can be serialized.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_protmethodGetContentString(SerializationContents, Boolean)

Returns a serializable or non serializable class and/or property names, depending on the specific flag value.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodLoad(Stream)

Loads serialized data into the control from an object derived from the Stream class.

System_CAPS_pubmethodLoad(String)

Loads serialized data saved to disk into the Chart control.

System_CAPS_pubmethodLoad(TextReader)

Loads serialized data into the control from a reader object that derives from the TextReader class.

System_CAPS_pubmethodLoad(XmlReader)

Loads serialized data into the control from an object derived from the XmlReader class.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodReset()

Resets all chart properties marked for serialization.

System_CAPS_pubmethodSave(Stream)

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

System_CAPS_pubmethodSave(String)

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

System_CAPS_pubmethodSave(TextWriter)

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

System_CAPS_pubmethodSave(XmlWriter)

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

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

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.

System_CAPS_importantImportant

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
Available since 4.0

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

Return to top
Show:
© 2016 Microsoft