Back to Devexpress

ChartControl.LoadFromStream(Stream) Method

windowsforms-devexpress-dot-xtracharts-dot-chartcontrol-dot-loadfromstream-x28-system-dot-io-dot-stream-x29.md

latest3.0 KB
Original Source

ChartControl.LoadFromStream(Stream) Method

SECURITY-RELATED CONSIDERATIONS

Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.

Restores the chart’s layout from the specified stream.

Namespace : DevExpress.XtraCharts

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

NuGet Package : DevExpress.Win.Charts

Declaration

csharp
public void LoadFromStream(
    Stream stream
)
vb
Public Sub LoadFromStream(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

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.

See the following help topic for additional information: Storing the Chart Layout.

Example

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

csharp
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);
vb
Imports System.IO
' ...

Dim stream As System.IO.Stream
stream = New System.IO.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

LoadFromFile(String)

SaveToStream(Stream)

Store the Chart Layout

ChartControl Class

ChartControl Members

DevExpress.XtraCharts Namespace