Enables serialization of the Chart control.
public ref class ChartSerializer
public class ChartSerializer
type ChartSerializer = class
Public Class ChartSerializer
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
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
Loadmethods, 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.
- 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.
Gets or sets the type of chart content to be serialized.
Gets or sets the format used when the chart is serialized.
Gets or sets a flag that indicates whether object properties are reset to default values before loading.
Gets or sets a flag that indicates whether the chart serializer is working in template-creation mode.
Gets or sets a flag that indicates whether unknown XML properties and elements will be ignored without throwing an exception.
Gets or sets the chart properties that will not be serialized.
Gets or sets the chart properties that can be serialized.
Determines whether the specified object is equal to the current object.(Inherited from Object)
Returns a serializable or non-serializable class and/or property names, depending on the specific flag value.
Serves as the default hash function.(Inherited from Object)
Gets the Type of the current instance.(Inherited from Object)
Loads serialized data into the control from an object derived from the Stream class.
Loads serialized data saved to disk into the Chart control.
Loads serialized data into the control from a reader object that derives from the TextReader class.
Loads serialized data into the control from an object derived from the XmlReader class.
Creates a shallow copy of the current Object.(Inherited from Object)
Resets all chart properties marked for serialization.
Saves chart data and properties with non-default values to an object that derives from the Stream class.
Saves chart data and properties with non-default values to the given file.
Saves chart data and properties with non-default values to the given object that is derived from the TextWriter class.
Saves chart data and properties with non-default values to the given object that is derived from the XmlWriter class.
Returns a string that represents the current object.(Inherited from Object)