We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to export the chart as an image (PNG format) without displaying UI

Platform: ASP.NET Core |
Control: Chart |
Published Date: February 25, 2019 |
Last Revised Date: April 11, 2019

In button click, you can export the chart as an image. To export the chart, you need to specify the export settings’ properties and call the export method at client-side.


The following code sample demonstrates the initialization of chart export settings and calling the export method.

<input type="button" value="PNG" onclick="chartPng()" />

<ej-chart id="container" enable-canvas-rendering="true">



//To call export method and settings

    function chartPng(sender) {

        var chart = $("#container").ejChart("instance"),

         exporting = chart.model.exportSettings;

        exporting.fileName = "chart";

        exporting.angle = 0;

        exporting.action = "Home/ExportChart";

        type = "png";

        exporting.mode = "server";







At server-side, export the chart to a specific folder. You can specify your required path in which the chart needs to be saved as an image.

// To specify corresponding folder

static string path = "D:\\";


// To export chart image in specified folder

public void ExportChart(string Data, string ChartModel)


            ChartProperties obj = ConvertChartObject(ChartModel);

            string type = obj.ExportSettings.Type.ToString().ToLower();

            string fileName = obj.ExportSettings.FileName;

            string orientation = obj.ExportSettings.Orientation.ToString();


            Data = Data.Remove(0, Data.IndexOf(',') + 1);

            MemoryStream stream = new MemoryStream(Convert.FromBase64String(Data));


            using (FileStream fs = new FileStream(path + "CoreChart.png", FileMode.Create))


                using (BinaryWriter bw = new BinaryWriter(fs))


                    byte[] data = Convert.FromBase64String(Data);






// To create chart properties

        private ChartProperties ConvertChartObject(string ChartModel)


            var settings = new JsonSerializerSettings


                NullValueHandling = NullValueHandling.Ignore,

                MissingMemberHandling = MissingMemberHandling.Ignore


            ChartProperties chartProp = new ChartProperties();

            chartProp = JsonConvert.DeserializeObject<ChartProperties>(ChartModel, settings);

            return chartProp;






Sample: ExportSample



2X faster development

The ultimate ASP.NET Core UI toolkit to boost your development speed.
You must log in to leave a comment
Hans Meier
Jan 13, 2020

This looks promising. Would be cool to have something similar in Blazor as well: https://www.syncfusion.com/feedback/11257/possibility-to-get-a-chart-as-image-in-c-without-exporting-it-as-image-file


Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon