Kendo Chart to JPG

8 posts, 0 answers
  1. Brett
    Brett avatar
    3 posts
    Member since:
    Jun 2014

    Posted 10 Jul 2014 Link to this post

    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.
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 14 Jul 2014 Link to this post

    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.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Gokhan
    Gokhan avatar
    15 posts
    Member since:
    Jan 2014

    Posted 23 Jul 2014 Link to this post

    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.
  5. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 25 Jul 2014 Link to this post

    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.

     
  6. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 25 Jul 2014 Link to this post

    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.

     
  7. Gokhan
    Gokhan avatar
    15 posts
    Member since:
    Jan 2014

    Posted 25 Jul 2014 in reply to Petur Subev Link to this post

    Sounds fair. Thank you Petur. 
  8. Gokhan
    Gokhan avatar
    15 posts
    Member since:
    Jan 2014

    Posted 12 Aug 2014 Link to this post

    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);
            }

  9. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 12 Aug 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready