This is a migrated thread and some comments may be shown as answers.

Save Chart to Image from Controller

1 Answer 250 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 23 Jun 2015, 08:43 PM

What would be the best way to:

1) Generate a chart

2) Convert it to an image

3) Save that chart image to a folder on the server

#1 is done easily enough but I have been unable to find any documentation how how I can make #2 and #3 happen and any help would be most appreciated!

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 26 Jun 2015, 10:06 AM
Hi,

Please accept my apologies for the delayed response.

You can start off by generating an image from the chart as demonstrated here.
    chart.exportImage().done(function(data) {
       ...
    });
In the context of the done function data would be a base-64 encoded image.

You can proceed and save it on the server:
    chart.exportImage().done(function(data) {
        kendo.saveAs({
            dataURI: data,
            fileName: "chart.png",
            forceProxy: true,
            proxyURL: "..."
        });
    });

 
If the proxy handler, for example, returns a 204 NO CONTENT the file won't be saved on the client.

I hope this helps.

Regards,
T. Tsonev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Scott
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or