Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ChartControl.LoadFromStream(Stream) Method

Restores the chart’s layout from the specified stream.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.2.UI.dll

NuGet Package: DevExpress.Win.Charts

#Declaration

public void LoadFromStream(
    Stream stream
)

#Parameters

Name Type Description
stream Stream

A Stream descendant from which settings are read.

#Remarks

Use the LoadFromStream method to load the chart’s layout from the stream to which the layout was saved via the ChartControl.SaveToStream method. If the specified stream is empty or null (Nothing in Visual Basic), an exception is raised.

For more information, refer to Storing the Chart Layout.

#Example

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

using System.IO;
// ...

Stream stream = new MemoryStream();
// ...

// Save the chart.
stream.Seek(0, System.IO.SeekOrigin.Begin);
chartControl1.SaveToStream(stream);

// Load the chart.
stream.Seek(0, System.IO.SeekOrigin.Begin);
chartControl1.LoadFromStream(stream);
See Also