Files
2022-11-04 13:24:24 +02:00

150 lines
4.6 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>Export to PDF, Image, SVG</title>
<meta charset="utf-8">
<link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
<link href="../../styles/kendo.common.min.css" rel="stylesheet">
<link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
<link href="../../styles/kendo.default.min.css" rel="stylesheet">
<link href="../../styles/kendo.default.mobile.min.css" rel="stylesheet">
<script src="../../js/jquery.min.js"></script>
<script src="../../js/jszip.min.js"></script>
<script src="../../js/kendo.all.min.js"></script>
<script src="../content/shared/js/console.js"></script>
<script>
</script>
</head>
<body>
<a class="offline-button" href="../index.html">Back</a>
<div id="example">
<div class="configurator">
<div class="header">Configurator</div>
<div class="box-col">
<h4>Advanced Export options</h4>
<div class="box-col">
<button class='export-pdf k-button'>Export as PDF</button>
</div>
<div class="box-col">
<button class='export-img k-button'>Export as Image</button>
</div>
<div class="box-col">
<button class='export-svg k-button'>Export as SVG</button>
</div>
</div>
</div>
<div id="gauge-container">
<div id="gauge"></div>
</div>
<script>
$(".export-pdf").click(function () {
var gauge = $("#gauge").getKendoLinearGauge();
gauge.exportPDF({ paperSize: "auto", margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" } }).done(function (data) {
kendo.saveAs({
dataURI: data,
fileName: "gauge.pdf",
proxyURL: "https://demos.telerik.com/kendo-ui/service/export"
});
});
});
$(".export-img").click(function () {
var gauge = $("#gauge").getKendoLinearGauge();
gauge.exportImage().done(function (data) {
kendo.saveAs({
dataURI: data,
fileName: "gauge.png",
proxyURL: "https://demos.telerik.com/kendo-ui/service/export"
});
});
});
$(".export-svg").click(function () {
var gauge = $("#gauge").getKendoLinearGauge();
gauge.exportSVG().done(function (data) {
kendo.saveAs({
dataURI: data,
fileName: "gauge.svg",
proxyURL: "https://demos.telerik.com/kendo-ui/service/export"
});
});
});
function createGauge() {
$("#gauge").kendoLinearGauge({
pointer: [{
value: 10,
shape: "arrow",
color: "#c20000"
}, {
value: 50,
color: "#ff7a00",
margin: 10
}, {
value: 30,
color: "#ffc700"
}, {
value: 45,
color: "#428bca",
shape: "arrow"
}],
scale: {
majorUnit: 20,
minorUnit: 2,
min: -40,
max: 60,
vertical: true,
ranges: [
{
from: -40,
to: -20,
color: "#2798df"
}, {
from: 30,
to: 45,
color: "#ffc700"
}, {
from: 45,
to: 60,
color: "#c20000"
}
]
}
});
}
$(document).ready(createGauge);
$(document).bind("kendo:skinChange", createGauge);
</script>
<style>
#gauge-container {
text-align: center;
margin: 0 auto;
background: transparent url("../content/dataviz/gauge/linear-gauge-container.png") no-repeat 50% 50%;
background-size: contain;
padding: 18px;
width: 300px;
height: 300px;
}
#gauge {
height: 100%;
display: inline-block;
*display: inline;
zoom: 1;
}
</style>
</div>
</body>
</html>