Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Collapse]Chart Control
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Fundamentals
   [Collapse]Concepts
    [Collapse]Creating Charts
     [Expand]2D Chart Types
     [Expand]3D Chart Types
     [Expand]Providing Data
     [Expand]Data Representation
     [Expand]Appearance Customization
     [Collapse]Miscellaneous
       Storing the Chart Layout
       Exporting a Chart
    [Expand]Chart Elements
    [Expand]End-User Interaction
     Supported Browsers
     Adding a Web Chart
     Handling Client-side Scripts
     Medium Trust Support
     Web Farm and Web Gardens Support
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]Examples
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Storing the Chart Layout

This document explains how a chart's layout can be saved and restored.

A chart's layout contains information about the chart's series and other elements, as well as their settings.

If chart series are manually populated with points, the layout also includes information on point arguments and values.

If a chart is bound to a data source, the information about series data members is included. Thus, when restoring the layout to another chart, you should simply reassign the chart's ASPxDataWebControlBase.DataSource property.

You can save and/or restore the layout of your WebChartControl in one of the two following ways.

Expanded Save and Restore the Layout at Design Time

At design time, a chart's layout can be quickly saved to an XML file by clicking the chart's smart tag and choosing Save... in its actions list.

Then, simply specify the path and name for the XML file.

Afterwards, click a chart's smart tag and choose Load... in its actions list to restore this layout.

Expanded Save and Restore the Layout at Runtime

At runtime, a chart's layout can be saved either to an XML file or to a memory stream, and then programmatically restored from it. The table below contains methods to store a chart's layout.

Methods used to save and restore a chart, grouped by platforms, are listed below.

Platform Member Description
ASP.NET WebChartControl.SaveToFile Saves the chart's layout to the specified file.
WebChartControl.SaveToStream Saves the chart's layout to the specified stream.
WebChartControl.LoadFromFile Restores the chart's layout from the specified file.
WebChartControl.LoadFromStream Restores the chart's layout from the specified stream.
ASP.NET MVC ChartControlSettings.SaveToFile Saves the chart's layout to the specified file.
ChartControlSettings.SaveToStream Saves the chart's layout to the specified stream.
ChartControlSettings.LoadFromFile Restores the chart's layout from the specified file.
ChartControlSettings.LoadFromStream Restores the chart's layout from the specified stream.
XtraReports XRChart.SaveToFile Saves the chart's layout to the specified file.
XRChart.SaveToStream Saves the chart's layout to the specified stream.
XRChart.LoadFromFile Restores the chart's layout from the specified file.
XRChart.LoadFromStream Restores the chart's layout from the specified stream.

The following example demonstrates how to save a chart to a memory stream, and then restore it.

Expanded See Also

How would you rate this topic?​​​​​​​