template/layouts/default.haml in gitstats-ruby-1.0.0 vs template/layouts/default.haml in gitstats-ruby-1.0.1

- old
+ new

@@ -3,13 +3,20 @@ %html{:xmlns => "http://www.w3.org/1999/xhtml"} %head %title Statistics %link{:href => 'style.css', :rel => 'stylesheet', :type => 'text/css'} + %link{:href => 'jquery.jqplot.min.css', :rel => 'stylesheet', :type => 'text/css'} %meta{'http-equiv' => 'content-type', :content => 'text/html; charset=UTF-8'} %script{:type => 'text/javascript', :src => 'jquery.js'} + %script{:type => 'text/javascript', :src => 'jquery.jqplot.min.js'} + %script{:type => 'text/javascript', :src => 'jqplot.cursor.min.js'} %script{:type => 'text/javascript', :src => 'jquery.tablesorter.js'} + %script{:type => 'text/javascript', :src => 'jqplot.dateAxisRenderer.min.js'} + %script{:type => 'text/javascript', :src => 'jqplot.canvasTextRenderer.min.js'} + %script{:type => 'text/javascript', :src => 'jqplot.canvasAxisTickRenderer.min.js'} + %script{:type => 'text/javascript', :src => 'jqplot.canvasAxisLabelRenderer.min.js'} %body :javascript $.tablesorter.addParser({ id: 'size', is: function(s) { @@ -26,9 +33,76 @@ $(".toggle").click(function() { $(this).toggleClass("active").next().slideToggle("slow"); return false; }); }); + + var jqplot_zoom_reset = function(evt, p, cursor) { + for(var i = 0;i < p.series.length;i++) { + p.series[i].showMarker = false; + p.series[i].markerOptions.show = false; + p.series[i].markerRenderer.show = false; + } + + p.redraw(); + }; + + var jqplot_zoom = function(evt, gridpos, datapos, p, cursor) { + var min = p.axes['xaxis'].min; + var max = p.axes['xaxis'].max; + + var maxaxis = { + yaxis: null, + y2axis: null, + y3axis: null, + y4axis: null, + y5axis: null, + y6axis: null, + y7axis: null, + y8axis: null, + y9axis: null + }; + + var cnt = []; + + var maxlen = 0; + for(var i = 0;i < p.series.length;i++) { + var len = p.series[i].data.length; + if(len > maxlen) + maxlen = len; + cnt[i] = 0; + } + + for(var i = 0;i < maxlen;i++) { + for(var j = 0;j < p.series.length;j++) { + if(i < p.series[j].data.length) { + if((p.series[j].data[i][0] >= min) && (p.series[j].data[i][0] <= max)) { + cnt[j]++; + if(maxaxis[p.series[j].yaxis] == null) + maxaxis[p.series[j].yaxis] = p.series[j].data[i][1]; + else if(p.series[j].data[i][1] > maxaxis[p.series[j].yaxis]) + maxaxis[p.series[j].yaxis] = p.series[j].data[i][1]; + } + } + } + } + + for(var i = 0;i < p.series.length;i++) { + p.series[i].showMarker = cnt[i] <= 100; + p.series[i].markerOptions.show = cnt[i] <= 100; + p.series[i].markerRenderer.show = cnt[i] <= 100; + } + + for(var ax in maxaxis) { + if(maxaxis[ax] != null) { + p.axes[ax].max = maxaxis[ax] * p.axes[ax].pad; + p.axes[ax].tickInterval = null; + p.axes[ax].numberTicks = null; + p.axes[ax]._ticks = []; + } + } + p.redraw(); + }; #menu %ul %li.first %a{:href => 'index.html'} General %li