Back to Devexpress

ChartControl.SaveToStream(Stream) Method

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

latest2.7 KB
Original Source

ChartControl.SaveToStream(Stream) Method

Saves the chart’s layout to the specified stream.

Namespace : DevExpress.XtraCharts

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

NuGet Package : DevExpress.Win.Charts

Declaration

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

Parameters

NameTypeDescription
streamStream

A Stream descendant to which the chart’s layout is written.

|

Remarks

The SaveToStream method saves the chart’s layout (the currently selected series views and its settings, etc.) to the specified stream. The saved settings can then be restored from storage using the ChartControl.LoadFromStream method.

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.

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

LoadFromStream(Stream)

SaveToFile(String)

Store the Chart Layout

ChartControl Class

ChartControl Members

DevExpress.XtraCharts Namespace