Export chart from screen to bitmap
Posted by Admin - on 08 February 2019 05:45 PM

It is required sometimes to save a Chart to an image file. SciChart provides the Export API for that. The available options are to export a Chart as a Bitmap or to export in the XPS (Vector)  format. Also it is possible to export a Chart into an image with higher resolution.

Export as a Bitmap

This feature support exporting to several image formats, like PNG, JPEG and BMP. To export a Chart as a bitmap, you need to call SciChartSurface.ExportToBitmapSource() or SciChartSurface.ExportToFile() specifying flag useXamlRenderSurface = False.

Export as Vector

To export in the XPS format, please call SciChartSurface.ExportToBitmapSource() or SciChartSurface.ExportToFile() specifying flag useXamlRenderSurface = True.

Export at Specific Resolution

To export to an image with higher resolution, specify the desired size when calling SciChartSurface.ExportToBitmapSource()  or SciChartSurface.ExportToFile().

NOTE: Please note that SciChart relies on the Serialization  to export in the XPS format or export at resolution other than the original chart size.

Using the Export API

To show how to use the Export API, we are going to create a Custom Modifier which will export and store a Chart as an image on Right Mouse Button click. And Left Double-Click will copy the Chart to Clipboard.

In order to achieve this, we have to derive from the ChartModifierBase class and override the OnModifierDoubleClick() and OnModifierMouseDown() methods as shown below:

public class ExportToBitmapModifier : ChartModifierBase
    // Make a chart screenshot on double-click
    public override void OnModifierDoubleClick(ModifierMouseArgs e)
var surface = ParentSurface as SciChartSurface; if (surface != null) { // Export surface to BitmapSource var image = surface.ExportToBitmapSource(); Clipboard.SetImage(image); } } // Save a screenshot of the chart on Right Mouse Button click public override void OnModifierMouseDown(ModifierMouseArgs e) { base.OnModifierMouseDown(e);
if (e.MouseButtons == MouseButtons.Right) { var saveFileDialog = new SaveFileDialog { Filter = "Png|*.png|Jpeg|*.jpeg|Bmp|*.bmp", InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) }; if (saveFileDialog.ShowDialog()) { var surface = ParentSurface as SciChartSurface; if(surface == null) return; var exportType = (ExportType)saveFileDialog.FilterIndex-1; // Saving chart to file with specified file format surface.ExportToFile(saveFileDialog.FileName,exportType); } } } }
Clicking a Chart with the Right Mouse Button should make a chart screenshot and store it to a file.

Further Reading

For further info and more detailed explanation of how the Export feature works please see our documentation:

Also there is an example available in SciChart Examples Suite that demonstrate Export / Printing capabilities:


(2 vote(s))
Not helpful


Not sure where to start? Contact us, we are happy to help!


SciChart Ltd, 16 Beaufort Court, Admirals Way, Docklands, London, E14 9XL. Email: Legal Company Number: 07430048, VAT Number: 101957725