Dundas Chart for ASP.NET
Load(String) Method
See Also  Example Send comments on this topic.
Dundas.Charting.WebControl Namespace > ChartSerializer Class > Load Method : Load(String) Method


fileName

The relative or absolute pathname of the file used to store the serialized data. If a relative pathname is used the pathname will be relative to the current directory. Also, to use a URL please use a Server.MapPath statement.


The file name used to load the data from.

Loads serialized data saved to disk into the Chart control.


Loads all properties of the chart from the file. By setting Content or SerializableContent/NonSerializableContent properties specific set of properties can be loaded.

Syntax

Visual Basic (Declaration)  
Public Overloads Sub Load( _
   ByVal fileName As String _
) 
Visual Basic (Usage) Copy Code
Dim instance As ChartSerializer
Dim fileName As String
 
instance.Load(fileName)
C#  
public void Load( 
   string fileName
)

Parameters

fileName

The relative or absolute pathname of the file used to store the serialized data. If a relative pathname is used the pathname will be relative to the current directory. Also, to use a URL please use a Server.MapPath statement.


The file name used to load the data from.

Example

The following example first serializes all appearance data to disk (only properties with non-default values), and then loads the serialized data. Axis labels are also serialized.

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 (
"SavedData.xml");
...

// Load the serialized data.
Chart1.Serializer.Content = SerializationContent.Appearance;
Chart1.Serializer.SerializableContent +=
",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name";
Chart1.Serializer.Load (
"SavedData.xml");
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("SavedData.xml")
...

' Load the serialized data
Chart1.Serializer.Content = SerializationContent.Appearance
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name"
Chart1.Serializer.Load ("SavedData.xml")

Remarks

Call this method to load serialized data into the Chart control.

When a load operation occurs by default serializable properties are first reset to their default values before they are set to the persisted values (if saved). To change this behavior use the ResetWhenLoaded property.

By default all serialized chart properties will be loaded. To load specific serialized properties set the Content, SerializableContent or NonSerializableContent properties before loading the data.

Note that when data is saved using the Save method only those properties that have non-default values are actually serialized.

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.