Typescript definitions for exporting not found

2 posts, 0 answers
  1. Falafel Support
    Falafel Support avatar
    24 posts
    Member since:
    Sep 2009

    Posted 27 Mar 2015 Link to this post

    Hello,

    I am trying to use exporting kendo chart as a TypeScript class to expose export methods across my application but both getKendoChart() and exportImage() (as does exportPDF and exportSVG) don't seem to be exposed.

    Below is the JS I am trying to use  

    var chart = $("#chart").getKendoChart();
    chart.exportImage().done(function(data) {
    kendo.saveAs({
    dataURI: data,
    fileName: "chart.png",
    });
    });

    And below is the TypeScript file I am trying to create 
    /// <reference path="../../scripts/typings/jquery/jquery.d.ts" />
    /// <reference path="../../scripts/typings/kendo/kendo.all.d.ts" />
     
    class KendoChartExporter {
        exportAsPng(id: string) {
            var chart = $("#chart").getKendoChart();
            chart.exportImage().done(function(data) {
                kendo.saveAs({
                    dataURI: data,
                    fileName: "chart.png",
                    proxyURL: "http://demos.telerik.com/kendo-ui/service/export"
                });
            });
        }
    }


    Am I missing anything?

    Thanks
    Venkata
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 31 Mar 2015 Link to this post

    Hello,

    The code looks good, but it seems to be missing the cast to specific widget type:
    var chart = <kendo.dataviz.ui.Chart>$("#chart").getKendoChart();

    The methods should be accessible after you add it.

    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top