質問

I have a kendo chart with the remote data. Is it possible to export the chart to png or pdf format

役に立ちましたか?

解決 2

It is possible if you use some third-party tool such as InkScape. The latter can convert SVG (the Kendo UI Chart native format) to pretty much anything else including PNG and PDF. You can use the svg method of the chart to get the underlying SVG and then send it to a remote service.

Here is an ASP.NET MVC application which shows how: https://github.com/telerik/kendo-examples-asp-net/tree/master/chart-inkscape-export

他のヒント

Since Atanas Korchev's answer, kendo has implemented a built-in method to export a chart as a png, svg or a pdf file.

If you want to export a png file you can do it by using the exportImage function:

kendoChart.exportImage().done(function(data) {
    kendo.saveAs({
        dataURI: data,
        fileName: "chart.png"
    });
});

For a PDF, it's almost the same logic with the exportPDF function:

chart.exportPDF({ paperSize: "Auto", landscape: true }).done(function(data) {
    kendo.saveAs({
        dataURI: data,
        fileName: "chart.pdf"
    });
});

You may refer to kendo chart API documentation for more details about those functions.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top