Permalink
Browse files

Merge branch 'master' of git://github.com/bgirard/eideticker

  • Loading branch information...
2 parents bf3a5e8 + 6fac8a6 commit 302cd690ffb6f3c8b85dd5e1f129de91fea51e24 @wlach wlach committed Aug 23, 2012
Showing with 51 additions and 8 deletions.
  1. +44 −1 src/dashboard/js/index.js
  2. +5 −5 src/dashboard/js/jquery.flot.navigate.js
  3. +2 −2 src/eideticker/eideticker/device.py
View
@@ -62,10 +62,12 @@ function updateGraph(rawdata, measure) {
// line graph (aggregate average per day)
var series2 = {
+ hoverLabel: "Average per day for " + type,
lines: { show: true },
color: color,
data: [],
- clickable: false
+ clickable: false,
+ hoverable: false
};
Object.keys(rawdata[type]).forEach(function(datestr) {
var numSamples = 0;
@@ -116,6 +118,47 @@ function updateGraph(rawdata, measure) {
plot.zoomOut();
});
+ function showTooltip(x, y, contents) {
+ $('<div id="tooltip">' + contents + '</div>').css( {
+ position: 'absolute',
+ display: 'none',
+ top: y + 5,
+ left: x + 5,
+ border: '1px solid #fdd',
+ padding: '2px',
+ 'background-color': '#fee',
+ opacity: 0.80
+ }).appendTo("body").fadeIn(200);
+ }
+
+ // Plot Hover tooltip
+ var previousPoint = null;
+ $("#graph-container").bind("plothover", function (event, pos, item) {
+ if (item) {
+ if (previousPoint != item.dataIndex) {
+ var toolTip;
+ var x = item.datapoint[0].toFixed(2),
+ y = item.datapoint[1].toFixed(2);
+
+ if (metadataHash[item.seriesIndex] && metadataHash[item.seriesIndex][item.dataIndex]) {
+ var metadata = metadataHash[item.seriesIndex][item.dataIndex];
+ toolTip = (item.series.label || item.series.hoverLabel) + " of " + (metadata.appDate || "'Unknown Date'") + " = " + y;
+ } else {
+ console.log(JSON.stringify(item.series));
+ toolTip = (item.series.label || item.series.hoverLabel) + " = " + y;
+ }
+
+ previousPoint = item.dataIndex;
+
+ $("#tooltip").remove();
+ showTooltip(item.pageX, item.pageY, toolTip);
+ }
+ } else {
+ $("#tooltip").remove();
+ previousPoint = null;
+ }
+ });
+
$("#graph-container").bind("plotclick", function (event, pos, item) {
plot.unhighlight();
if (item) {
@@ -92,17 +92,17 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
/* jquery.mousewheel.min.js
- * Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ * Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
+ * Licensed under the MIT License (LICENSE.txt).
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
+ * Thanks to: Seamus Leahy for adding deltaX and deltaY
*
- * Version: 3.0.2
+ * Version: 3.0.6
*
* Requires: 1.2.2+
*/
-(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
+(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;void 0!==b.axis&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);void 0!==b.wheelDeltaY&&(g=b.wheelDeltaY/120);void 0!==b.wheelDeltaX&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,!1);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,!1);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
@@ -65,9 +65,9 @@ def _shellCheckOutput(self, args):
retval = self.shell(args, buf)
output = str(buf.getvalue()[0:-1]).rstrip()
if retval == None:
- raise Exception("Did not successfully run command %s (output: '%s')" % (args, output))
+ raise Exception("Did not successfully run command %s (output: '%s', retval: 'None')" % (args, output))
if retval != 0:
- raise Exception("Non-zero return code for command: %s (output: '%s')" % (args, output))
+ raise Exception("Non-zero return code for command: %s (output: '%s', retval: '%i')" % (args, output, retval))
return output
def _executeScript(self, events, executeCallback=None):

0 comments on commit 302cd69

Please sign in to comment.