Dundas Chart for Windows Forms
ChartSerializer Class
Members  See Also  Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace : ChartSerializer Class


This class allows for serialization of the Chart control.


ChartSerializer class provides chart serialization API. Depending on the Format property XmlFormatSerializer or BinaryFormatserializer classes will be used internally.

Syntax

Visual Basic (Declaration)  
Public Class ChartSerializer 
Visual Basic (Usage) Copy Code
Dim instance As ChartSerializer
C#  
public class ChartSerializer 

Remarks

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

Serialization saves the state of the chart and also provides the ability 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.

XML or binary formats can be used to store serialized data. XML is used by default, but this can be changed using 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/loaded using a file, stream, TextWriter/TextReader and XMLWriter/XMLReader objects. When saving/loading data using an object derived from TextReader, TextWriter, XMLReader or XMLWriter the format of the data must be XML.

The following describes three ways to define serializable data (basic to advanced). Note that it is also possible to define non-serializable data, which is described in the next paragraph.

  1. Serialization of the Chart using the Save and Load methods without specifying any serializable properties. This will result in the serialization of all chart properties with non-default values (this includes chart data).
     
  2. Serialization of chart properties specified by the Content property. The Content property groups the chart properties to be serialized into categories (e.g. data, appearance, etc.). 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). It is important to know that the Content property is implemented internally by the control as the SerializableContent property.
     
  3. Serialization of chart properties specified by the SerializableContent property. This is a comma-separated listing of all chart properties that are serializable. Once this property is set to an explicit value then it is up to the developer to specify all properties to be saved (i.e. 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 (common when wildcards are used) the SerializableContent property has precedence. However, precedence also depends on how many wildcards were used when specifying a property.

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

Inheritance Hierarchy

System.Object
   Dundas.Charting.WinControl.ChartSerializer

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

© 2009 All Rights Reserved.