exportImage
Exports the chart as an image. The result can be saved using kendo.saveAs.
The export operation is asynchronous and returns a promise. The promise will be resolved with a PNG image encoded as a Data URI.
Parameters
options Object
(optional)Parameters for the exported image.
options.width String
The width of the exported image. Defaults to the chart width.
options.height String
The height of the exported image. Defaults to the chart height.
options.cors String
(default: "anonymous")Specifies how cross-origin images
should be requested.
Requesting images without CORS will "taint" the canvas. It will still be visible on the page, but all script access to it is disabled to prevent information disclosure.
By default they're requested anonymously. Available options are:
- "anonymous" - do not send user credentials as part of the request
- "use-credentials" - send credentials as part of the request
- false - fetch images without CORS, possibly tainting the canvas
See crossorigin attribute for more details.
ReturnsPromise
A promise that will be resolved with a PNG image encoded as a Data URI.
Example - Exporting a chart to an image
<div id="chart"></div>
<script>
$("#chart").kendoChart({
transitions: false,
series: [{
type: "column",
data: [1, 2, 3]
}, {
type: "line",
data: [2, 1, 3]
}, {
type: "area",
data: [3, 1, 2]
}]
});
var chart = $("#chart").getKendoChart();
chart.exportImage().done(function(data) {
kendo.saveAs({
dataURI: data,
fileName: "chart.png"
});
});
</script>