From 37a285cd1d1026c56fcdb3cca0ebda45675a786e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 20 Sep 2012 12:08:57 +0530 Subject: [PATCH] removed zoom from grid report --- js/lib/flot/jquery.flot.navigate.js | 12 ++++---- js/wn/views/grid_report.js | 48 ++--------------------------- 2 files changed, 9 insertions(+), 51 deletions(-) diff --git a/js/lib/flot/jquery.flot.navigate.js b/js/lib/flot/jquery.flot.navigate.js index f2b97603c3..30b23bd368 100755 --- a/js/lib/flot/jquery.flot.navigate.js +++ b/js/lib/flot/jquery.flot.navigate.js @@ -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); @@ -333,4 +333,4 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L name: 'navigate', version: '1.3' }); -})(jQuery); +})(jQuery); \ No newline at end of file diff --git a/js/wn/views/grid_report.js b/js/wn/views/grid_report.js index 17d1d09407..f4b116aeb3 100644 --- a/js/wn/views/grid_report.js +++ b/js/wn/views/grid_report.js @@ -262,7 +262,7 @@ wn.views.GridReport = Class.extend({ }, apply_filters_from_route: function() { - var hash = window.location.hash; + var hash = decodeURIComponent(window.location.hash); var me = this; if(hash.indexOf('/') != -1) { $.each(hash.split('/').splice(1).join('/').split('&'), function(i, f) { @@ -350,16 +350,10 @@ wn.views.GridReport = Class.extend({ } wn.require('js/lib/flot/jquery.flot.js'); - var plot_options = this.get_plot_options(); - var plot_area = this.wrapper.find('.plot'); - // if zoom, require navigate - if(plot_options.zoom) wn.require('js/lib/flot/jquery.flot.navigate.js'); - - this.plot = $.plot(plot_area.toggle(true), plot_data, plot_options); + this.plot = $.plot(this.wrapper.find('.plot').toggle(true), plot_data, + this.get_plot_options()); this.setup_plot_hover(); - // setup zoom if required - if(plot_options.zoom) this.setup_plot_zoom(plot_area); }, setup_plot_hover: function() { var me = this; @@ -395,42 +389,6 @@ wn.views.GridReport = Class.extend({ }); }, - setup_plot_zoom: function(plot_area) { - var me = this; - - // add zoom out button - $('zoom in') - .appendTo(plot_area) - .click(function (e) { - e.preventDefault(); - me.plot.zoom(); - }); - - // add zoom out button - $('zoom out') - .appendTo(plot_area) - .click(function (e) { - e.preventDefault(); - me.plot.zoomOut(); - }); - - - // and add panning buttons - // little helper for taking the repetitive work out of placing - // panning arrows - function addArrow(direction, style, offset) { - var t = $('') - .appendTo(plot_area).click(function (e) { - e.preventDefault(); - me.plot.pan(offset); - }); - } - - addArrow('left', "top:100px; left: 600px", { left: -100 }); - addArrow('right', "top: 100px; left: 650px", { left: 100 }); - addArrow('up', "top: 50px; left: 625px", { top: -100 }); - addArrow('down', "top: 150px; left: 625px", { top: 100 }); - }, get_tooltip_text: function(label, x, y) { var date = dateutil.obj_to_user(new Date(x)); var value = fmt_money(y);