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

134 lines
4.2 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>Multiple pointers</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" class="k-content">
<div class="configurator">
<div class="header">Configurator</div>
<div class="box-col">
<h4>Red pointer value</h4>
<input id="gauge-value0" class="slider" value="10" style="width: 220px;">
<h4 style="margin-top: 30px;">Get all pointer values</h4>
<button id="getValues" class="k-button">Get all</button>
</div>
<div class="box-col">
<h4>Orange pointer value</h4>
<input id="gauge-value1" class="slider" value="70" style="width: 220px;">
<h4 style="margin-top: 30px;">Set all pointer values</h4>
<input id="newValues" class="k-textbox" value="100, 10, 80" style="width: 110px;" />
<button id="setValues" class="k-button">Set all</button>
</div>
<div class="box-col">
<h4>Yellow pointer value</h4>
<input id="gauge-value2" class="slider" value="140" style="width: 220px;">
</div>
</div>
<div id="gauge-container">
<div id="gauge"></div>
</div>
<script>
function createGauge() {
$("#gauge").kendoLinearGauge({
pointer: [{
value: 10,
color: "#c20000",
shape: "arrow"
}, {
value: 70,
color: "#ff7a00",
margin: 10
}, {
value: 140,
color: "#ffc700"
}],
scale: {
minorUnit: 5,
min: 0,
max: 180,
vertical: true
}
});
}
$(document).ready(function () {
createGauge();
$("#example .slider").each(function () {
$(this).kendoSlider({
min: 0,
max: 180,
showButtons: false,
change: function () {
var id = this.element.attr("id");
var pointerIndex = id.substr(id.length - 1);
var gauge = $("#gauge").data("kendoLinearGauge");
gauge.pointers[pointerIndex].value(this.value());
}
});
});
$("#getValues").click(function () {
alert("All values: " + $("#gauge").data("kendoLinearGauge").allValues().join(", "));
});
$("#setValues").click(function () {
var values = $("#newValues").val().split(",");
values = $.map(values, function (val) {
return parseInt(val);
});
$("#gauge").data("kendoLinearGauge").allValues(values);
});
$(document).bind("kendo:skinChange", function (e) {
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;
zoom: 1;
}
</style>
</div>
</body>
</html>