Exporting

Export as an image

You can export the Chart as a JPG image using SaveAsImage method of SfChart.

SfChart chart = new SfChart();
...

chart.SaveAsImage("ChartSample.jpg");

The exported image will be saved in the different location across the platforms.

Android – The image will be saved inside the Pictures directory.

iOS – The image will be saved inside the “Photos/Album” directory.

Windows Phone – The image will be saved inside the “/Pictures/ Saved Pictures” directory.

NOTE

In order to save the image in Android and Windows Phone, you have to enable the permission to write the file in device storage.

Get the stream of Chart

‘SfChart’ contains the following methods to get the chart stream.

GetStream

The GetStream method of SfChart is used to get the chart as stream. The output stream can be passed as an input of any other components which accept the stream such as pdf, excel, word etc. This method is only applicable for Android and iOS platforms only.

SfChart chart = new SfChart();
...

chart.GetStream();

GetStreamAsync

The GetStreamAsync method of SfChart is used to get the chart as stream asynchronously.

NOTE

This method will work only when the SfChart view in UI.

The following code snippet demonstrates the usage of this method:

SfChart chart = new SfChart();
...

var stream = await chart.GetStreamAsync();