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

Kendo Chart to JPG

7 Answers 80 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 1
Brett asked on 10 Jul 2014, 03:21 PM
I have been looking for awhile on how to export a chart to a JPG on a button click. I have found some documentation on the matter and most of the links are broken or the solution doesn't work. Is there an current examples of a chart being exported to jpg or png?

One of links I have found is http://www.telerik.com/support/code-library/kendo-ui-chart-export and the project doesn't seem to want to pull up for me.

7 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 14 Jul 2014, 09:00 AM
Hello Brett,

Indeed exporting chart to an image file is not supported out-of-the-box. The only scenario that we have regarding exporting is covered within the code library project that you linked. If I understand correctly you are not able to download it, so I attached the archive in this thread.

Kind Regards,
Petur Subev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Gokhan
Top achievements
Rank 1
answered on 23 Jul 2014, 01:26 PM
Hi Petur Subev. The code you give works okay for me. I can easily get my charts to jpg.

But i have a simple problem, i have a problem with Turkish characters related to Kendo Chart's Title. What should i do? Thank you.
0
Petur Subev
Telerik team
answered on 25 Jul 2014, 12:23 PM
Hello Brett,

Charts messages that will be used when you export are the same as the one which are rendered the client, so you need to customize the messages on the client first. So if you want to change the title you should change the title of the chart via the corresponding option:

http://docs.telerik.com/kendo-ui/api/dataviz/chart#configuration-title.text

Kind Regards,
Petur Subev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Petur Subev
Telerik team
answered on 25 Jul 2014, 12:27 PM
Hello,

If the symbols are not recognized by the font that Inkscape uses, you will need to search for a way to work this on the Inkscape forums, since it is not actually related to the Kendo framework.

https://bugs.launchpad.net/inkscape/+bug/887327

I am sorry for the inconvenience

Kind Regards,
Petur Subev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Gokhan
Top achievements
Rank 1
answered on 25 Jul 2014, 01:55 PM
Sounds fair. Thank you Petur. 
0
Gokhan
Top achievements
Rank 1
answered on 12 Aug 2014, 07:30 AM
Unicode character solution if someone needs it -->


Change _Export action like that:

  public ActionResult _Export(string svg, KendoChartExport.Models.ExportFormat format)
        {
      
            svg = svg.Replace("%F6", "ö");
            svg = svg.Replace("%D6", "Ö");

            svg = svg.Replace("%C7", "Ç");
            svg = svg.Replace("%E7", "ç");

            svg = svg.Replace("%DC", "Ü");
            svg = svg.Replace("%FC", "ü");

            svg = svg.Replace("%C7", "Ç");

            var svgText = HttpUtility.UrlDecode(svg, abc);
            var svgFile = TempFileName() + ".svg";
            System.IO.File.WriteAllText(svgFile, svgText);

            var outFile = DoExport(svgFile, format);
            var attachment = "export" + System.IO.Path.GetExtension(outFile);

            return File(outFile, MimeTypes[format], attachment);
        }

0
T. Tsonev
Telerik team
answered on 12 Aug 2014, 08:12 AM
Hi,

Thanks for sharing this solution.

Another option would be to instruct the UrlDecode method to use the Latin-5 encoding:
    var latin5 = System.Text.Encoding.GetEncoding("ISO-8859-9");
    var svgText = HttpUtility.UrlDecode(svg, latin5);


I hope this helps.

Regards,
T. Tsonev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
Brett
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Gokhan
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or