forked from emoncms/emoncms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A whole load of commits to the dashboard module to make public dashbo…
…ards work again, changes to site top nav menu and other polishing and hacks to get the whole application to work as expected and be backwards compatible
- Loading branch information
trystan
committed
Mar 13, 2013
1 parent
f761677
commit 37565a2
Showing
24 changed files
with
375 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ Modules/raspberrypi | |
Modules/site | ||
Modules/command | ||
Modules/sap | ||
Modules/time | ||
Modules/rss | ||
Modules/adminusers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.Container-White { | ||
background: none repeat scroll 0 0 #FFFFFF; | ||
border: 1px solid #E5E5E5; | ||
box-shadow: 0 4px 10px -1px rgba(200, 200, 200, 0.7); | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
|
||
.Container-Grey { | ||
background: none repeat scroll 0 0 #ddd; | ||
border: 1px solid #ccc; | ||
box-shadow: 0 4px 10px -1px rgba(200, 200, 200, 0.7); | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
|
||
.Container-Black { | ||
background: none repeat scroll 0 0 #000; | ||
border: 1px solid #888; | ||
box-shadow: 0 4px 10px -1px rgba(200, 200, 200, 0.7); | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
|
||
.Container-BlueLine { | ||
|
||
border: 3px solid #0d97f3; | ||
box-shadow: 0px 0px 2px 2px rgba(200, 200, 200, 0.7); | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
|
||
.heading-center { | ||
font-weight:bold; | ||
font-size:24px; | ||
padding-top:20px; | ||
text-align:center; | ||
} | ||
|
||
.feedvalue { | ||
font-weight:bold; | ||
font-size:24px; | ||
padding-top:20px; | ||
text-align:center; | ||
color:#4444CC; | ||
} | ||
|
||
.heading { | ||
font-weight:bold; | ||
font-size:24px; | ||
padding-top:20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
123 changes: 123 additions & 0 deletions
123
Modules/dashboard/Views/js/widgets/jgauge/jgauge_render.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
// Global variables | ||
var img = null, | ||
needle = null; | ||
|
||
function jgauge_widgetlist() | ||
{ | ||
var widgets = { | ||
"jgauge": | ||
{ | ||
"offsetx":-80,"offsety":-80,"width":160,"height":160, | ||
"menu":"Widgets", | ||
"options":["feed", "max", "units"], | ||
"optionstype":["feed","value","value"] | ||
} | ||
} | ||
return widgets; | ||
} | ||
|
||
function jgauge_init() | ||
{ | ||
setup_widget_canvas('jgauge'); | ||
|
||
// Load the needle image | ||
needle = new Image(); | ||
needle.src = path+'Modules/dashboard/Views/js/widgets/jgauge/needle2.png'; | ||
|
||
// Load the jgauge image | ||
img = new Image(); | ||
img.src = path+'Modules/dashboard/Views/js/widgets/jgauge/jgauge.png'; | ||
} | ||
|
||
function jgauge_draw() | ||
{ | ||
$('.jgauge').each(function(index) | ||
{ | ||
var feed = $(this).attr("feed"); | ||
var val = curve_value(feed,dialrate); | ||
// ONLY UPDATE ON CHANGE | ||
if ((val * 1).toFixed(2) != (assoc[feed] * 1).toFixed(2) || redraw == 1) | ||
{ | ||
var id = "can-"+$(this).attr("id"); | ||
var scale = 1*$(this).attr("scale") || 1; | ||
draw_jgauge(widgetcanvas[id],0,0,$(this).width(),$(this).height(),val*scale,$(this).attr("max"),$(this).attr("units")); | ||
} | ||
}); | ||
} | ||
|
||
function jgauge_slowupdate() | ||
{ | ||
|
||
} | ||
|
||
function jgauge_fastupdate() | ||
{ | ||
jgauge_draw(); | ||
} | ||
|
||
function draw_jgauge(ctx,x,y,width,height,value,max,units) | ||
{ | ||
if (!max) max = 1000; | ||
if (!value) value = 0; | ||
if (!units) units = " "; | ||
var offset = 45; | ||
var position = ((value*270)/max); | ||
if (position > 270) { | ||
position = 270; | ||
} | ||
var size = 0; | ||
if (width>height) { | ||
size = height; | ||
} else { | ||
size = width; | ||
} | ||
if (size>170) size=170; | ||
if (size<120) size=120; | ||
|
||
ctx.clearRect(0,0,width,height); | ||
|
||
// Draw the jgauge onto the canvas | ||
ctx.drawImage(img, 0, 0, size, size); | ||
|
||
//ticks labels | ||
ctx.font = "8pt Arial"; | ||
ctx.fillStyle = "rgb(34,198,252)"; | ||
ctx.fillText(0, 28*(size/100), 70*(size/100)); // first tick | ||
ctx.fillText(Math.floor(max/6)*1, 20*(size/100), 52*(size/100)); // second tick | ||
ctx.fillText(Math.floor(max/6)*2, 25*(size/100), 33*(size/100)); // third tick | ||
ctx.fillText(Math.floor(max/6)*3, 45*(size/100), 22*(size/100)); // 4th tick | ||
ctx.fillText(Math.floor(max/6)*4, 65*(size/100), 33*(size/100)); // 5th tick | ||
ctx.fillStyle = "rgb(245,144,0)"; | ||
ctx.fillText(Math.floor(max/6)*5, 75*(size/100), 52*(size/100)); // 6th tick | ||
ctx.fillStyle = "rgb(255,0,0)"; | ||
ctx.fillText(Math.floor(max), 65*(size/100), 70*(size/100)); // 7th tick | ||
|
||
// main label | ||
ctx.font = "15pt Calibri,Geneva,Arial"; | ||
ctx.strokeStyle = "rgb(255,255,255)"; | ||
ctx.fillStyle = "rgb(255,255,255)"; | ||
if (value<10) { | ||
ctx.fillText(Math.floor(value)+units, 43*(size/100), 85*(size/100)); | ||
} | ||
else if ((value<100) && (value>10)) { | ||
ctx.fillText(Math.floor(value)+units, 40*(size/100), 85*(size/100)); | ||
} | ||
else { | ||
ctx.fillText(Math.floor(value)+units, 37*(size/100), 85*(size/100)); | ||
} | ||
|
||
// Save the current drawing state | ||
ctx.save(); | ||
|
||
// move to the middle of the image | ||
ctx.translate((size/2), (size/2)); | ||
|
||
// Rotate around this point | ||
ctx.rotate((position + offset) * (Math.PI / 180)); | ||
|
||
// Draw the image back and up | ||
ctx.drawImage(needle, -(size/2), -(size/2), size, size); | ||
|
||
// Restore the previous drawing state | ||
ctx.restore(); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.