Search Results for

    Show / Hide Table of Contents

    Export Chart to Bitmap

    SciChart features a number of ways to export the chart to Bitmap.

    Export Chart from Screen to Bitmap

    SciChart supports export to Bitmap. To take screenshot the current chart on screen and get a Bitmap in memory, call the following code:

    • Java
    • Java with Builders API
    • Kotlin
    // Assume a surface has been created and configured somewhere
    final Bitmap screenshot = surface.exportToBitmap();
    
    // Assume a surface has been created and configured somewhere
    final Bitmap screenshot = surface.exportToBitmap();
    
    // Assume a surface has been created and configured somewhere
    val screenshot = surface.exportToBitmap()
    

    Export Chart to Bitmap in Memory at specific Size

    SciChart supports exporting to Bitmap at a specific size without showing chart on screen ( in-memory export ). This method can be used to create a larger or higher resolution image than the chart currently on screen.

    To do this, please use the following code:

    • Java
    • Java with Builders API
    • Kotlin
    // create new SciChartSurface
    final SciChartSurface sciChartSurface = new SciChartSurface(getActivity());
    
    // init it with axes, series etc
    initSurface(sciChartSurface);
    
    // prepare it for export at specified size
    SciChartSurfaceExportUtil.prepareSurfaceForExport(sciChartSurface, 800, 600);
    
    // export it to Bitmap
    final Bitmap screenshot = sciChartSurface.exportToBitmap();
    
    // create new SciChartSurface
    final SciChartSurface sciChartSurface = new SciChartSurface(getActivity());
    
    // init it with axes, series etc
    initSurface(sciChartSurface);
    
    // prepare it for export at specified size
    SciChartSurfaceExportUtil.prepareSurfaceForExport(sciChartSurface, 800, 600);
    
    // export it to Bitmap
    final Bitmap screenshot = sciChartSurface.exportToBitmap();
    
    // create new SciChartSurface
    val sciChartSurface = SciChartSurface(activity)
    
    // init it with axes, series etc
    initSurface(sciChartSurface)
    
    // prepare it for export at specified size
    SciChartSurfaceExportUtil.prepareSurfaceForExport(sciChartSurface, 800, 600)
    
    // export it to Bitmap
    val screenshot = sciChartSurface.exportToBitmap()
    

    Export ViewGroup which contains ScichartSurface

    By default SciChartSurface can be used with different IRenderSurface implementations. Some of them (e.g. RenderSurfaceGL which uses OpenGL for rendering of its content) won't be visible when you call draw() on parent ViewGroup. So if you need to export ViewGroup which contains SciChartSurface then you need to switch to Canvas based RenderSurface before export:

    • Java
    • Java with Builders API
    • Kotlin
    // Assume a surface has been created and configured somewhere
    surface.setRenderSurface(new RenderSurface(getContext()));
    
    // Assume a surface has been created and configured somewhere
    surface.setRenderSurface(new RenderSurface(getContext()));
    
    // Assume a surface has been created and configured somewhere
    surface.renderSurface = RenderSurface(context)
    
    Back to top © 2011-2025 SciChart. All rights reserved. | sitemap.xml