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

145 lines
4.3 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>Scale options</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>Gauge scale should...</h4>
<ul class="options">
<li>
<input id="vertical" checked="checked" type="checkbox" autocomplete="off">
<label for="vertical">... be vertical</label>
</li>
<li>
<input id="labels" checked="checked" type="checkbox" autocomplete="off">
<label for="labels">... show labels</label>
</li>
<li>
<input id="ranges" checked="checked" type="checkbox" autocomplete="off">
<label for="ranges">... show ranges</label>
</li>
</ul>
</div>
</div>
<div id="gauge-container">
<div id="gauge"></div>
</div>
<script>
function createGauge() {
$("#gauge").kendoLinearGauge({
pointer: {
value: 65,
shape: "arrow"
},
scale: {
majorUnit: 20,
minorUnit: 5,
max: 180,
ranges: [
{
from: 80,
to: 120,
color: "#ffc700"
}, {
from: 120,
to: 150,
color: "#ff7a00"
}, {
from: 150,
to: 180,
color: "#c20000"
}
]
}
});
}
$(document).ready(function () {
createGauge();
$(".box-col").bind("change", refresh);
$(document).bind("kendo:skinChange", function (e) {
createGauge();
refresh();
});
window.configuredRanges = $("#gauge").data("kendoLinearGauge").options.scale.ranges;
});
function refresh() {
var gauge = $("#gauge").data("kendoLinearGauge"),
showLabels = $("#labels").prop("checked"),
showRanges = $("#ranges").prop("checked"),
isVertical = $("#vertical").prop("checked"),
positionInputs = $("input[name='labels-position']"),
options = gauge.options;
options.transitions = false;
options.scale.labels.visible = showLabels;
options.scale.vertical = isVertical;
options.scale.ranges = showRanges ? window.configuredRanges : [];
$("#gauge-container").toggleClass("horizontal", !isVertical);
gauge.redraw();
}
</script>
<style>
#gauge-container {
text-align: center;
margin-left: 30px;
background: transparent url("../content/dataviz/gauge/linear-gauge-container.png") no-repeat 50% 50%;
background-size: contain;
padding: 18px;
width: 300px;
height: 300px;
margin: 0 auto;
}
#gauge-container.horizontal {
background-image: url("../content/dataviz/gauge/linear-gauge-container-h.png");
}
#gauge {
width: 100%;
height: 100%;
margin: 0 auto 0;
}
</style>
</div>
</body>
</html>