Dundas Chart for ASP.NET
ResetWhenLoading Property
See Also  Example Send comments on this topic.
Dundas.Charting.WebControl Namespace > ChartSerializer Class : ResetWhenLoading Property


Determines if chart properties marked for serialization are reset to their default values before serialized data is loaded.


Indicates that object properties are reset to default values before loading.

Syntax

Visual Basic (Declaration)  
Public Property ResetWhenLoading As Boolean
Visual Basic (Usage) Copy Code
Dim instance As ChartSerializer
Dim value As Boolean
 
instance.ResetWhenLoading = value
 
value = instance.ResetWhenLoading
C#  
public bool ResetWhenLoading {get; set;}

Return Value

If True then serializable properties (specified by the Content, SerializableContent and NonSerializableContent properties) are reset to their default values when the Load method is called. If False they are not reset. Defaults to True.

Example

The following example first serializes all appearance data to disk (only properties with non-default values), then loads the appearance data without resetting the chart's properties to their defaults. Axis labels are also serialized.

Visual Basic Copy Code
' 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("AppearanceProps.xml")
...

' Load the serialized appearance properties. We will not reset chart properties, in case
' appearance properties were changed from default values to explicit values after the data
' was serialized
Chart1.Serializer.ResetWhenLoading = false
Chart1.Serializer.Content = SerializationContent.Appearance
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name"
Chart1.Serializer.Load("AppearanceProps.xml")
C# Copy Code
// 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(
"AppearanceProps.xml");
...

// Load the serialized appearance properties. We will not reset chart properties, in case
//   appearance properties were changed from default values to explicit values after the data
//   was serialized
Chart1.Serializer.ResetWhenLoading = false;
Chart1.Serializer.Content = SerializationContent.Appearance;
Chart1.Serializer.SerializableContent +=
",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name";
Chart1.Serializer.Load(
"AppearanceProps.xml");

Remarks

When chart data is serialized only properties that do not have default values are persisted (this reduces the amount of saved data). Therefore it is possible for a serializable property to not be saved, and during a load operation by default this property will be reset to its default value. If it is possible that a serializable property is set to a non-default value after data is saved then set this property to False so that the default value will not overwrite the non-default value.       

Properties of a chart can be reset at any time using the Reset method.

Please note that care must be taken when resetting collection properties. If "Chart.Series" or "Chart.ChartAreas" have been set as specific items to be persisted then resetting the chart (i.e. ResetWhenLoading is True) will result in all Series or ChartArea items to be deleted from the chart when the data is saved and then loaded. This means that all data points in the chart series will be lost.

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.