Skip to content

Commit

Permalink
Merge branch 'reverse-feature'
Browse files Browse the repository at this point in the history
  • Loading branch information
toorshia committed Nov 10, 2015
2 parents 0f9ff93 + 4bb87fc commit 2cb9495
Show file tree
Hide file tree
Showing 4 changed files with 493 additions and 25 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Checkout http://justgage.com for details, demos, current release and more.

###Update log

######November 10, 2015.
* **reverse** - reverse the gauge direction - demo at http://justgage.com/examples/reverse.html
* **pointer** - render triangular value pointer - demo at http://justgage.com/examples/pointer.html


######November 08, 2015.
* **defaults** - option to define common config object when you're creating multiple gauges - demo at http://justgage.com/examples/defaults.html

Expand Down
166 changes: 166 additions & 0 deletions examples/pointer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8" />
<title>Custom Sectors</title>
<meta name="viewport" content="width=device-width">
<style>
.wrapper {
position: relative;
width: 640px;
height: 480px;
margin: 50px auto 0 auto;
padding-bottom: 30px;
border: 1px solid #ccc;
border-radius: 3px;
clear: both;
}

.box {
float: left;
width: 50%;
height: 50%;
box-sizing: border-box;
}

.container {
width: 450px;
margin: 0 auto;
text-align: center;
}

.gauge {
width: 320px;
height: 240px;
}

button {
margin: 30px 5px 0 2px;
padding: 16px 40px;
border-radius: 5px;
font-size: 18px;
border: none;
background: #34aadc;
color: white;
cursor: pointer;
}
</style>
</head>

<body>
<div class="wrapper">
<div class="box">
<div id="g1" class="gauge"></div>
</div>
<div class="box">
<div id="g2" class="gauge"></div>
</div>
<div class="box">
<div id="g3" class="gauge"></div>
</div>
<div class="box">
<div id="g4" class="gauge"></div>
</div>
</div>
<div class="container">
<button type="button" id="gauge_refresh">Refresh Gauges</button>
</div>
<script src="../raphael-2.1.4.min.js"></script>
<script src="../justgage.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function(event) {

var g1 = new JustGage({
id: 'g1',
value: 65,
min: 0,
max: 100,
symbol: '%',
pointer: true,
gaugeWidthScale: 0.6,
customSectors: [{
color: '#ff0000',
lo: 50,
hi: 100
}, {
color: '#00ff00',
lo: 0,
hi: 50
}],
counter: true
});

var g2 = new JustGage({
id: 'g2',
value: 45,
min: 0,
max: 100,
symbol: '%',
pointer: true,
pointerOptions: {
toplength: -15,
bottomlength: 10,
bottomwidth: 12,
color: '#8e8e93',
stroke: '#ffffff',
stroke_width: 3,
stroke_linecap: 'round'
},
gaugeWidthScale: 0.6,
counter: true
});

var g3 = new JustGage({
id: 'g3',
value: 40,
min: 0,
max: 100,
symbol: '%',
pointer: true,
gaugeWidthScale: 1.3,
pointerOptions: {
toplength: 5,
bottomlength: 5,
bottomwidth: 4
},
customSectors: [{
color: "#ff0000",
lo: 50,
hi: 100
}, {
color: "#00ff00",
lo: 0,
hi: 50
}],
counter: true
});

var g4 = new JustGage({
id: 'g4',
value: 70,
min: 0,
max: 100,
symbol: '%',
pointer: true,
pointerOptions: {
toplength: 8,
bottomlength: -20,
bottomwidth: 6,
color: '#8e8e93'
},
gaugeWidthScale: 0.1,
counter: true
});

document.getElementById('gauge_refresh').addEventListener('click', function() {
g1.refresh(getRandomInt(0, 100));
g2.refresh(getRandomInt(0, 100));
g3.refresh(getRandomInt(0, 100));
g4.refresh(getRandomInt(0, 100));
});
});
</script>
</body>

</html>
144 changes: 144 additions & 0 deletions examples/reverse.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8" />
<title>Custom Sectors</title>
<meta name="viewport" content="width=device-width">
<style>
.wrapper {
position: relative;
width: 640px;
height: 480px;
margin: 50px auto 0 auto;
padding-bottom: 30px;
border: 1px solid #ccc;
border-radius: 3px;
clear: both;
}

.box {
float: left;
width: 50%;
height: 50%;
box-sizing: border-box;
}

.container {
width: 450px;
margin: 0 auto;
text-align: center;
}

.gauge {
width: 320px;
height: 240px;
}

button {
margin: 30px 5px 0 2px;
padding: 16px 40px;
border-radius: 5px;
font-size: 18px;
border: none;
background: #34aadc;
color: white;
cursor: pointer;
}
</style>
</head>

<body>
<div class="wrapper">
<div class="box">
<div id="g1" class="gauge"></div>
</div>
<div class="box">
<div id="g2" class="gauge"></div>
</div>
<div class="box">
<div id="g3" class="gauge"></div>
</div>
<div class="box">
<div id="g4" class="gauge"></div>
</div>
</div>
<div class="container">
<button type="button" id="gauge_refresh">Refresh Gauges</button>
</div>
<script src="../raphael-2.1.4.min.js"></script>
<script src="../justgage.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function(event) {

var g1 = new JustGage({
id: 'g1',
value: 65,
min: 0,
max: 100,
reverse: true,
gaugeWidthScale: 0.6,
customSectors: [{
color: '#ff0000',
lo: 50,
hi: 100
}, {
color: '#00ff00',
lo: 0,
hi: 50
}],
counter: true
});

var g2 = new JustGage({
id: 'g2',
value: 45,
min: 0,
max: 500,
reverse: true,
gaugeWidthScale: 0.6,
counter: true
});

var g3 = new JustGage({
id: 'g3',
value: 25000,
min: 0,
max: 100000,
humanFriendly : true,
reverse: true,
gaugeWidthScale: 1.3,
customSectors: [{
color: "#ff0000",
lo: 50000,
hi: 100000
}, {
color: "#00ff00",
lo: 0,
hi: 50000
}],
counter: true
});

var g4 = new JustGage({
id: 'g4',
value: 90,
min: 0,
max: 100,
symbol: '%',
reverse: true,
gaugeWidthScale: 0.1,
counter: true
});

document.getElementById('gauge_refresh').addEventListener('click', function() {
g1.refresh(getRandomInt(0, 100));
g2.refresh(getRandomInt(0, 100));
g3.refresh(getRandomInt(0, 100000));
g4.refresh(getRandomInt(0, 100));
});
});
</script>
</body>

</html>
Loading

0 comments on commit 2cb9495

Please sign in to comment.