Skip to content

Commit

Permalink
[docs] Added example with variable min max values
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Oct 9, 2019
1 parent 80960ca commit 22a5915
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docs/examples/negative_numbers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8" />
<title>Refresh object</title>
<meta name="viewport" content="width=device-width">
<style>
.container {
width: 450px;
margin: 50px auto 0 auto;
text-align: center;
}

.gauge {
width: 450px;
height: 450px;
}

a:link.button,
a:active.button,
a:visited.button,
a:hover.button {
margin: 30px 5px 0 2px;
padding: 7px 13px;
}
</style>
</head>

<body>
<div class="container">
<div id="g1" class="gauge"></div>
<a href="#" id="g1_refresh" class="button grey">Refresh Object</a>
</div>
<script src="../raphael.min.js"></script>
<script src="../justgage.js"></script>
<script>
/** Random integer */
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

document.addEventListener("DOMContentLoaded", function (event) {

var min = -100, max = 100;

var g1 = new JustGage({
id: "g1",
title: "Max is 100.",
value: 0,
min: min,
max: max,
decimals: 0,
gaugeWidthScale: 0.6
});

document.getElementById('g1_refresh').addEventListener('click', function () {
max = getRandomInt(20, 100)
min = getRandomInt(-100, 10)
g1.refresh(getRandomInt(min, max), max , min);
});

});
</script>
</body>

</html>

0 comments on commit 22a5915

Please sign in to comment.