value?min:value>max?max:value}function setSelectionPos(pos,e){var o=plot.getOptions(),offset=plot.getPlaceholder().offset(),plotOffset=plot.getPlotOffset();pos.x=clamp(0,e.pageX-offset.left-plotOffset.left,plot.width()),pos.y=clamp(0,e.pageY-offset.top-plotOffset.top,plot.height()),"y"==o.selection.mode&&(pos.x=pos==selection.first?0:plot.width()),"x"==o.selection.mode&&(pos.y=pos==selection.first?0:plot.height())}function updateSelection(pos){null!=pos.pageX&&(setSelectionPos(selection.second,pos),selectionIsSane()?(selection.show=!0,plot.triggerRedrawOverlay()):clearSelection(!0))}function clearSelection(preventEvent){selection.show&&(selection.show=!1,plot.triggerRedrawOverlay(),preventEvent||plot.getPlaceholder().trigger("plotunselected",[]))}function extractRange(ranges,coord){var axis,from,to,key,axes=plot.getAxes();for(var k in axes)if(axis=axes[k],axis.direction==coord&&(key=coord+axis.n+"axis",ranges[key]||1!=axis.n||(key=coord+"axis"),ranges[key])){from=ranges[key].from,to=ranges[key].to;break}if(ranges[key]||(axis="x"==coord?plot.getXAxes()[0]:plot.getYAxes()[0],from=ranges[coord+"1"],to=ranges[coord+"2"]),null!=from&&null!=to&&from>to){var tmp=from;from=to,to=tmp}return{from:from,to:to,axis:axis}}function setSelection(ranges,preventEvent){var range,o=plot.getOptions();"y"==o.selection.mode?(selection.first.x=0,selection.second.x=plot.width()):(range=extractRange(ranges,"x"),selection.first.x=range.axis.p2c(range.from),selection.second.x=range.axis.p2c(range.to)),"x"==o.selection.mode?(selection.first.y=0,selection.second.y=plot.height()):(range=extractRange(ranges,"y"),selection.first.y=range.axis.p2c(range.from),selection.second.y=range.axis.p2c(range.to)),selection.show=!0,plot.triggerRedrawOverlay(),!preventEvent&&selectionIsSane()&&triggerSelectedEvent()}function selectionIsSane(){var minSize=plot.getOptions().selection.minSize;return Math.abs(selection.second.x-selection.first.x)>=minSize&&Math.abs(selection.second.y-selection.first.y)>=minSize}var selection={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},savedhandlers={},mouseUpHandler=null;plot.clearSelection=clearSelection,plot.setSelection=setSelection,plot.getSelection=getSelection,plot.hooks.bindEvents.push(function(plot,eventHolder){var o=plot.getOptions();null!=o.selection.mode&&(eventHolder.mousemove(onMouseMove),eventHolder.mousedown(onMouseDown))}),plot.hooks.drawOverlay.push(function(plot,ctx){if(selection.show&&selectionIsSane()){var plotOffset=plot.getPlotOffset(),o=plot.getOptions();ctx.save(),ctx.translate(plotOffset.left,plotOffset.top);var c=$.color.parse(o.selection.color);ctx.strokeStyle=c.scale("a",.8).toString(),ctx.lineWidth=1,ctx.lineJoin=o.selection.shape,ctx.fillStyle=c.scale("a",.4).toString();var x=Math.min(selection.first.x,selection.second.x)+.5,y=Math.min(selection.first.y,selection.second.y)+.5,w=Math.abs(selection.second.x-selection.first.x)-1,h=Math.abs(selection.second.y-selection.first.y)-1;ctx.fillRect(x,y,w,h),ctx.strokeRect(x,y,w,h),ctx.restore()}}),plot.hooks.shutdown.push(function(plot,eventHolder){eventHolder.unbind("mousemove",onMouseMove),eventHolder.unbind("mousedown",onMouseDown),mouseUpHandler&&$(document).unbind("mouseup",mouseUpHandler)})}$.plot.plugins.push({init:init,options:{selection:{mode:null,color:"#e8cfac",shape:"round",minSize:5}},name:"selection",version:"1.1"})}(jQuery),function($,h,c){function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);(m!==o.w||l!==o.h)&&n.trigger(j,[o.w=m,o.h=l])}),g()},e[b])}var i,a=$([]),e=$.resize=$.extend($.resize,{}),k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250,e[f]=!0,$.event.special[j]={setup:function(){if(!e[f]&&this[k])return!1;var l=$(this);a=a.add(l),$.data(this,d,{w:l.width(),h:l.height()}),1===a.length&&g()},teardown:function(){if(!e[f]&&this[k])return!1;var l=$(this);a=a.not(l),l.removeData(d),a.length||clearTimeout(i)},add:function(l){function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width(),r.h=p!==c?p:q.height(),n.apply(this,arguments)}if(!e[f]&&this[k])return!1;var n;return $.isFunction(l)?(n=l,m):(n=l.handler,void(l.handler=m))}}}(jQuery,this),function($){function init(plot){function onResize(){var placeholder=plot.getPlaceholder();0!=placeholder.width()&&0!=placeholder.height()&&(plot.resize(),plot.setupGrid(),plot.draw())}function bindEvents(plot,eventHolder){plot.getPlaceholder().resize(onResize)}function shutdown(plot,eventHolder){plot.getPlaceholder().unbind("resize",onResize)}plot.hooks.bindEvents.push(bindEvents),plot.hooks.shutdown.push(shutdown)}var options={};$.plot.plugins.push({init:init,options:options,name:"resize",version:"1.0"})}(jQuery),$(document).ready(function(){function animateSection(sectionName,offset){$("html,body").animate({scrollTop:$(sectionName).offset().top+offset},750)}function switchStandardsList(el){standardsList.hide(),chosenValue=el.val(),$('[data-attr="'+chosenValue+'"]').show()}function getGraphData(){$($('[data-role="url-stats"]').get().reverse()).each(function(){var el=$(this);storeDatum(el,getXAxisLabel(el))})}function getXAxisLabel(el){return el.find('[data-role="date"]').attr("data-value")}function storeDatum(el,label){$.each(el.find("[data-label]"),function(){var type=$(this).attr("data-label"),value=$(this).html();"undefined"==typeof data[type]&&(data[type]=[]),data[type].push([label,+value])})}function plotGraphData(){$.plot(graphContainer,getData(),graphOptions)}function getData(){return[{color:"rgb(216, 61, 45)",label:"Errors",data:data.error},{color:"rgb(168, 103, 0)",label:"Warnings",data:data.warning},{color:"rgb(23, 123, 190)",label:"Notices",data:data.notice}]}function toggleResetZoomButton(){zoomResetButton.toggleClass("hidden")}function plotAccordingToChoices(){var data=[];choiceContainer.find("input:checked").each(function(){var key=$(this).attr("name");key&&datasets[key]&&data.push(datasets[key])}),data.length>-1&&$.plot(graphContainer,data,graphOptions)}function showTooltip(x,y,contents){$('").css({top:y+5,left:x+5}).appendTo("body").fadeIn(200)}function initTaskFilter(container){var tasks=initTaskFilterTasks(container);initTaskFilterInput(container,tasks)}function initTaskFilterTasks(container){var tasks=container.find("[data-role=task]");return tasks}function initTaskFilterInput(container,tasks){var input=container.find("[data-role=input]");return input.on("keyup",function(){filterTasks(tasks,input.val())}),input}function filterTasks(tasks,query){if(query=$.trim(query.replace(/[^a-z0-9\s]+/gi,"")),tasks.removeClass("hidden"),!/^\s*$/.test(query)){var queryRegExp=new RegExp("("+query.replace(/\s+/gi,"|")+")","i");tasks.filter(function(){return!queryRegExp.test($(this).data("keywords"))}).addClass("hidden")}}var data={},standardsList=$('[data-role="standards-list"]'),standardSelect=$('[data-role="new-task-select"]'),expandLink=$('[data-role="expander"]'),taskListSelector=$('[data-role="task-list"] a'),toTopLinks=$('[data-role="top"]'),zoomResetButton=$('[data-role="zoom-reset"]'),graphContainer=$('[data-role="graph"]'),dateSelectDropdownMenu=$('[data-role="date-select-dropdown-menu"]'),graphOptions={series:{lines:{show:!0},points:{show:!0},hoverable:!0},xaxis:{mode:"time",tickLength:0,minTickSize:[1,"day"],timeformat:"%d %b"},yaxis:{tickDecimals:0},lines:{lineWidth:3},grid:{backgroundColor:"#fff",borderColor:"#808080",hoverable:!0,clickable:!0,borderWidth:{top:1,right:1,bottom:1,left:1}},selection:{mode:"x"}};expandLink.click(function(){$(this).next().slideToggle("slow",function(){}),$(this).hasClass("showing")?($(this).find("span.expander").html("+"),$(this).attr("aria-expanded",!1)):($(this).find("span.expander").html("-"),$(this).attr("aria-expanded",!0)),$(this).toggleClass("showing")}),$(document).on("keydown.lists",'[data-role="expander"]',function(e){var $this=$(this),k=e.which||e.keyCode;/(13|32)/.test(k)&&((13===k||32===k)&&$this.click(),e.preventDefault(),e.stopPropagation())}),toTopLinks.click(function(e){e.preventDefault(),$(animateSection($("#top"),-55))}),switchStandardsList(standardSelect),$(".rules-list-title").addClass("hidden"),$(".date-links").removeClass("list-group date-links").addClass("dropdown-menu"),$(".dropdown-menu a").removeClass("list-group-item"),dateSelectDropdownMenu.removeClass("hidden"),standardSelect.change(function(){switchStandardsList($(this))}),taskListSelector.click(function(e){e.preventDefault(),target=$(this).attr("href"),animateSection($(target),-25),$(target).hasClass("showing")||$(target).click()}),zoomResetButton.click(function(){plotGraphData(),toggleResetZoomButton()}),$.each(graphContainer,function(){getGraphData(),plotGraphData()}),$('[data-role="rules-tooltip"]').tooltip(),graphContainer.bind("plotselected",function(event,ranges){ranges.xaxis.to-ranges.xaxis.from<1e-5&&(ranges.xaxis.to=ranges.xaxis.from+1e-5),ranges.yaxis.to-ranges.yaxis.from<1e-5&&(ranges.yaxis.to=ranges.yaxis.from+1e-5),plot=$.plot(graphContainer,getData(ranges.xaxis.from,ranges.xaxis.to),$.extend(!0,{},graphOptions,{xaxis:{min:ranges.xaxis.from,max:ranges.xaxis.to},yaxis:{min:ranges.yaxis.from,max:ranges.yaxis.to}})),zoomResetButton.is(":visible")||toggleResetZoomButton()});var choiceContainer=$('[data-role="series-checkboxes"]'),datasets=getData();$.each(datasets,function(key,val){var lowerCaseValue=val.label.substring(0,val.label.length-1).toLowerCase();choiceContainer.append(''+val.label+"
")}),choiceContainer.find("input").click(plotAccordingToChoices),choiceContainer.find("[data-stat-type=errors]").click();var previousPoint=null;graphContainer.bind("plothover",function(event,pos,item){if(item){if(previousPoint!=item.dataIndex){previousPoint=item.dataIndex,$('[data-role="tooltip"]').remove();var count=item.datapoint[1].toFixed(0),date=$.plot.formatDate(new Date(item.datapoint[0]),"%d %b (%H:%M) "),contents=''+date+" "+count+" "+item.series.label+"[h6]>";showTooltip(item.pageX,item.pageY,contents)}}else $('[data-role="tooltip"]').remove(),previousPoint=null});var taskLists=$("[data-control=task-list]");taskLists.length>0&&$("[data-control=task-list]").each(function(){initTaskFilter($(this))}),$.fn.collapse.Constructor.prototype.keydown=function(e){var $this=$(this),k=e.which||e.keyCode;/(13|32)/.test(k)&&((13===k||32===k)&&$this.click(),e.preventDefault(),e.stopPropagation())},$('[data-toggle="collapse"]').attr("role","button").attr("tabindex",0),$(document).on("keydown.collapse.data-api",'[data-toggle="collapse"]',$.fn.collapse.Constructor.prototype.keydown)});
\ No newline at end of file
+return ticks},axis.tickFormatter=function(value,axis){var factor=axis.tickDecimals?Math.pow(10,axis.tickDecimals):1,formatted=""+Math.round(value*factor)/factor;if(null!=axis.tickDecimals){var decimal=formatted.indexOf("."),precision=-1==decimal?0:formatted.length-decimal-1;if(precision0&&(null==opts.min&&(axis.min=Math.min(axis.min,niceTicks[0])),null==opts.max&&niceTicks.length>1&&(axis.max=Math.max(axis.max,niceTicks[niceTicks.length-1]))),axis.tickGenerator=function(axis){var v,i,ticks=[];for(i=0;i1&&/\..*0$/.test((ts[1]-ts[0]).toFixed(extraDec))||(axis.tickDecimals=extraDec)}}}}function setTicks(axis){var oticks=axis.options.ticks,ticks=[];null==oticks||"number"==typeof oticks&&oticks>0?ticks=axis.tickGenerator(axis):oticks&&(ticks=$.isFunction(oticks)?oticks(axis):oticks);var i,v;for(axis.ticks=[],i=0;i1&&(label=t[1])):v=+t,null==label&&(label=axis.tickFormatter(v,axis)),isNaN(v)||axis.ticks.push({v:v,label:label})}}function snapRangeToTicks(axis,ticks){axis.options.autoscaleMargin&&ticks.length>0&&(null==axis.options.min&&(axis.min=Math.min(axis.min,ticks[0].v)),null==axis.options.max&&ticks.length>1&&(axis.max=Math.max(axis.max,ticks[ticks.length-1].v)))}function draw(){surface.clear(),executeHooks(hooks.drawBackground,[ctx]);var grid=options.grid;grid.show&&grid.backgroundColor&&drawBackground(),grid.show&&!grid.aboveData&&drawGrid();for(var i=0;ito){var tmp=from;from=to,to=tmp}return{from:from,to:to,axis:axis}}function drawBackground(){ctx.save(),ctx.translate(plotOffset.left,plotOffset.top),ctx.fillStyle=getColorOrGradient(options.grid.backgroundColor,plotHeight,0,"rgba(255, 255, 255, 0)"),ctx.fillRect(0,0,plotWidth,plotHeight),ctx.restore()}function drawGrid(){var i,axes,bw,bc;ctx.save(),ctx.translate(plotOffset.left,plotOffset.top);var markings=options.grid.markings;if(markings)for($.isFunction(markings)&&(axes=plot.getAxes(),axes.xmin=axes.xaxis.min,axes.xmax=axes.xaxis.max,axes.ymin=axes.yaxis.min,axes.ymax=axes.yaxis.max,markings=markings(axes)),i=0;ixrange.axis.max||yrange.toyrange.axis.max||(xrange.from=Math.max(xrange.from,xrange.axis.min),xrange.to=Math.min(xrange.to,xrange.axis.max),yrange.from=Math.max(yrange.from,yrange.axis.min),yrange.to=Math.min(yrange.to,yrange.axis.max),(xrange.from!=xrange.to||yrange.from!=yrange.to)&&(xrange.from=xrange.axis.p2c(xrange.from),xrange.to=xrange.axis.p2c(xrange.to),yrange.from=yrange.axis.p2c(yrange.from),yrange.to=yrange.axis.p2c(yrange.to),xrange.from==xrange.to||yrange.from==yrange.to?(ctx.beginPath(),ctx.strokeStyle=m.color||options.grid.markingsColor,ctx.lineWidth=m.lineWidth||options.grid.markingsLineWidth,ctx.moveTo(xrange.from,yrange.from),ctx.lineTo(xrange.to,yrange.to),ctx.stroke()):(ctx.fillStyle=m.color||options.grid.markingsColor,ctx.fillRect(xrange.from,yrange.to,xrange.to-xrange.from,yrange.from-yrange.to))))}axes=allAxes(),bw=options.grid.borderWidth;for(var j=0;jaxis.max||"full"==t&&("object"==typeof bw&&bw[axis.position]>0||bw>0)&&(v==axis.min||v==axis.max)||("x"==axis.direction?(x=axis.p2c(v),yoff="full"==t?-plotHeight:t,"top"==axis.position&&(yoff=-yoff)):(y=axis.p2c(v),xoff="full"==t?-plotWidth:t,"left"==axis.position&&(xoff=-xoff)),1==ctx.lineWidth&&("x"==axis.direction?x=Math.floor(x)+.5:y=Math.floor(y)+.5),ctx.moveTo(x,y),ctx.lineTo(x+xoff,y+yoff))}ctx.stroke()}}bw&&(bc=options.grid.borderColor,"object"==typeof bw||"object"==typeof bc?("object"!=typeof bw&&(bw={top:bw,right:bw,bottom:bw,left:bw}),"object"!=typeof bc&&(bc={top:bc,right:bc,bottom:bc,left:bc}),bw.top>0&&(ctx.strokeStyle=bc.top,ctx.lineWidth=bw.top,ctx.beginPath(),ctx.moveTo(0-bw.left,0-bw.top/2),ctx.lineTo(plotWidth,0-bw.top/2),ctx.stroke()),bw.right>0&&(ctx.strokeStyle=bc.right,ctx.lineWidth=bw.right,ctx.beginPath(),ctx.moveTo(plotWidth+bw.right/2,0-bw.top),ctx.lineTo(plotWidth+bw.right/2,plotHeight),ctx.stroke()),bw.bottom>0&&(ctx.strokeStyle=bc.bottom,ctx.lineWidth=bw.bottom,ctx.beginPath(),ctx.moveTo(plotWidth+bw.right,plotHeight+bw.bottom/2),ctx.lineTo(0,plotHeight+bw.bottom/2),ctx.stroke()),bw.left>0&&(ctx.strokeStyle=bc.left,ctx.lineWidth=bw.left,ctx.beginPath(),ctx.moveTo(0-bw.left/2,plotHeight+bw.bottom),ctx.lineTo(0-bw.left/2,0),ctx.stroke())):(ctx.lineWidth=bw,ctx.strokeStyle=options.grid.borderColor,ctx.strokeRect(-bw/2,-bw/2,plotWidth+bw,plotHeight+bw))),ctx.restore()}function drawAxisLabels(){$.each(allAxes(),function(_,axis){if(axis.show&&0!=axis.ticks.length){var tick,x,y,halign,valign,box=axis.box,legacyStyles=axis.direction+"Axis "+axis.direction+axis.n+"Axis",layer="flot-"+axis.direction+"-axis flot-"+axis.direction+axis.n+"-axis "+legacyStyles,font=axis.options.font||"flot-tick-label tickLabel";surface.removeText(layer);for(var i=0;iaxis.max||("x"==axis.direction?(halign="center",x=plotOffset.left+axis.p2c(tick.v),"bottom"==axis.position?y=box.top+box.padding:(y=box.top+box.height-box.padding,valign="bottom")):(valign="middle",y=plotOffset.top+axis.p2c(tick.v),"left"==axis.position?(x=box.left+box.width-box.padding,halign="right"):x=box.left+box.padding),surface.addText(layer,x,y,tick.label,font,null,null,halign,valign))}})}function drawSeries(series){series.lines.show&&drawSeriesLines(series),series.bars.show&&drawSeriesBars(series),series.points.show&&drawSeriesPoints(series)}function drawSeriesLines(series){function plotLine(datapoints,xoffset,yoffset,axisx,axisy){var points=datapoints.points,ps=datapoints.pointsize,prevx=null,prevy=null;ctx.beginPath();for(var i=ps;i=y1&&y1=y2&&y2=y2&&y1>axisy.max){if(y2>axisy.max)continue;x1=(axisy.max-y1)/(y2-y1)*(x2-x1)+x1,y1=axisy.max}else if(y2>=y1&&y2>axisy.max){if(y1>axisy.max)continue;x2=(axisy.max-y1)/(y2-y1)*(x2-x1)+x1,y2=axisy.max}if(x2>=x1&&x1=x2&&x2=x2&&x1>axisx.max){if(x2>axisx.max)continue;y1=(axisx.max-x1)/(x2-x1)*(y2-y1)+y1,x1=axisx.max}else if(x2>=x1&&x2>axisx.max){if(x1>axisx.max)continue;y2=(axisx.max-x1)/(x2-x1)*(y2-y1)+y1,x2=axisx.max}(x1!=prevx||y1!=prevy)&&ctx.moveTo(axisx.p2c(x1)+xoffset,axisy.p2c(y1)+yoffset),prevx=x2,prevy=y2,ctx.lineTo(axisx.p2c(x2)+xoffset,axisy.p2c(y2)+yoffset)}}ctx.stroke()}function plotLineArea(datapoints,axisx,axisy){for(var points=datapoints.points,ps=datapoints.pointsize,bottom=Math.min(Math.max(0,axisy.min),axisy.max),i=0,areaOpen=!1,ypos=1,segmentStart=0,segmentEnd=0;;){if(ps>0&&i>points.length+ps)break;i+=ps;var x1=points[i-ps],y1=points[i-ps+ypos],x2=points[i],y2=points[i+ypos];if(areaOpen){if(ps>0&&null!=x1&&null==x2){segmentEnd=i,ps=-ps,ypos=2;continue}if(0>ps&&i==segmentStart+ps){ctx.fill(),areaOpen=!1,ps=-ps,ypos=1,i=segmentStart=segmentEnd+ps;continue}}if(null!=x1&&null!=x2){if(x2>=x1&&x1=x2&&x2=x2&&x1>axisx.max){if(x2>axisx.max)continue;y1=(axisx.max-x1)/(x2-x1)*(y2-y1)+y1,x1=axisx.max}else if(x2>=x1&&x2>axisx.max){if(x1>axisx.max)continue;y2=(axisx.max-x1)/(x2-x1)*(y2-y1)+y1,x2=axisx.max}if(areaOpen||(ctx.beginPath(),ctx.moveTo(axisx.p2c(x1),axisy.p2c(bottom)),areaOpen=!0),y1>=axisy.max&&y2>=axisy.max)ctx.lineTo(axisx.p2c(x1),axisy.p2c(axisy.max)),ctx.lineTo(axisx.p2c(x2),axisy.p2c(axisy.max));else if(y1<=axisy.min&&y2<=axisy.min)ctx.lineTo(axisx.p2c(x1),axisy.p2c(axisy.min)),ctx.lineTo(axisx.p2c(x2),axisy.p2c(axisy.min));else{var x1old=x1,x2old=x2;y2>=y1&&y1=axisy.min?(x1=(axisy.min-y1)/(y2-y1)*(x2-x1)+x1,y1=axisy.min):y1>=y2&&y2=axisy.min&&(x2=(axisy.min-y1)/(y2-y1)*(x2-x1)+x1,y2=axisy.min),y1>=y2&&y1>axisy.max&&y2<=axisy.max?(x1=(axisy.max-y1)/(y2-y1)*(x2-x1)+x1,y1=axisy.max):y2>=y1&&y2>axisy.max&&y1<=axisy.max&&(x2=(axisy.max-y1)/(y2-y1)*(x2-x1)+x1,y2=axisy.max),x1!=x1old&&ctx.lineTo(axisx.p2c(x1old),axisy.p2c(y1)),ctx.lineTo(axisx.p2c(x1),axisy.p2c(y1)),ctx.lineTo(axisx.p2c(x2),axisy.p2c(y2)),x2!=x2old&&(ctx.lineTo(axisx.p2c(x2),axisy.p2c(y2)),ctx.lineTo(axisx.p2c(x2old),axisy.p2c(y2)))}}}}ctx.save(),ctx.translate(plotOffset.left,plotOffset.top),ctx.lineJoin="round";var lw=series.lines.lineWidth,sw=series.shadowSize;if(lw>0&&sw>0){ctx.lineWidth=sw,ctx.strokeStyle="rgba(0,0,0,0.1)";var angle=Math.PI/18;plotLine(series.datapoints,Math.sin(angle)*(lw/2+sw/2),Math.cos(angle)*(lw/2+sw/2),series.xaxis,series.yaxis),ctx.lineWidth=sw/2,plotLine(series.datapoints,Math.sin(angle)*(lw/2+sw/4),Math.cos(angle)*(lw/2+sw/4),series.xaxis,series.yaxis)}ctx.lineWidth=lw,ctx.strokeStyle=series.color;var fillStyle=getFillStyle(series.lines,series.color,0,plotHeight);fillStyle&&(ctx.fillStyle=fillStyle,plotLineArea(series.datapoints,series.xaxis,series.yaxis)),lw>0&&plotLine(series.datapoints,0,0,series.xaxis,series.yaxis),ctx.restore()}function drawSeriesPoints(series){function plotPoints(datapoints,radius,fillStyle,offset,shadow,axisx,axisy,symbol){for(var points=datapoints.points,ps=datapoints.pointsize,i=0;iaxisx.max||yaxisy.max||(ctx.beginPath(),x=axisx.p2c(x),y=axisy.p2c(y)+offset,"circle"==symbol?ctx.arc(x,y,radius,0,shadow?Math.PI:2*Math.PI,!1):symbol(ctx,x,y,radius,shadow),ctx.closePath(),fillStyle&&(ctx.fillStyle=fillStyle,ctx.fill()),ctx.stroke())}}ctx.save(),ctx.translate(plotOffset.left,plotOffset.top);var lw=series.points.lineWidth,sw=series.shadowSize,radius=series.points.radius,symbol=series.points.symbol;if(0==lw&&(lw=1e-4),lw>0&&sw>0){var w=sw/2;ctx.lineWidth=w,ctx.strokeStyle="rgba(0,0,0,0.1)",plotPoints(series.datapoints,radius,null,w+w/2,!0,series.xaxis,series.yaxis,symbol),ctx.strokeStyle="rgba(0,0,0,0.2)",plotPoints(series.datapoints,radius,null,w/2,!0,series.xaxis,series.yaxis,symbol)}ctx.lineWidth=lw,ctx.strokeStyle=series.color,plotPoints(series.datapoints,radius,getFillStyle(series.points,series.color),0,!1,series.xaxis,series.yaxis,symbol),ctx.restore()}function drawBar(x,y,b,barLeft,barRight,offset,fillStyleCallback,axisx,axisy,c,horizontal,lineWidth){var left,right,bottom,top,drawLeft,drawRight,drawTop,drawBottom,tmp;horizontal?(drawBottom=drawRight=drawTop=!0,drawLeft=!1,left=b,right=x,top=y+barLeft,bottom=y+barRight,left>right&&(tmp=right,right=left,left=tmp,drawLeft=!0,drawRight=!1)):(drawLeft=drawRight=drawTop=!0,drawBottom=!1,left=x+barLeft,right=x+barRight,bottom=b,top=y,bottom>top&&(tmp=top,top=bottom,bottom=tmp,drawBottom=!0,drawTop=!1)),rightaxisx.max||topaxisy.max||(leftaxisx.max&&(right=axisx.max,drawRight=!1),bottomaxisy.max&&(top=axisy.max,drawTop=!1),left=axisx.p2c(left),bottom=axisy.p2c(bottom),right=axisx.p2c(right),top=axisy.p2c(top),fillStyleCallback&&(c.beginPath(),c.moveTo(left,bottom),c.lineTo(left,top),c.lineTo(right,top),c.lineTo(right,bottom),c.fillStyle=fillStyleCallback(bottom,top),c.fill()),lineWidth>0&&(drawLeft||drawRight||drawTop||drawBottom)&&(c.beginPath(),c.moveTo(left,bottom+offset),drawLeft?c.lineTo(left,top+offset):c.moveTo(left,top+offset),drawTop?c.lineTo(right,top+offset):c.moveTo(right,top+offset),drawRight?c.lineTo(right,bottom+offset):c.moveTo(right,bottom+offset),drawBottom?c.lineTo(left,bottom+offset):c.moveTo(left,bottom+offset),c.stroke()))}function drawSeriesBars(series){function plotBars(datapoints,barLeft,barRight,offset,fillStyleCallback,axisx,axisy){for(var points=datapoints.points,ps=datapoints.pointsize,i=0;i"),fragments.push(""),rowStarted=!0),fragments.push(''+entry.label+" ")}if(rowStarted&&fragments.push(" "),0!=fragments.length){var table='";if(null!=options.legend.container)$(options.legend.container).html(table);else{var pos="",p=options.legend.position,m=options.legend.margin;null==m[0]&&(m=[m,m]),"n"==p.charAt(0)?pos+="top:"+(m[1]+plotOffset.top)+"px;":"s"==p.charAt(0)&&(pos+="bottom:"+(m[1]+plotOffset.bottom)+"px;"),"e"==p.charAt(1)?pos+="right:"+(m[0]+plotOffset.right)+"px;":"w"==p.charAt(1)&&(pos+="left:"+(m[0]+plotOffset.left)+"px;");var legend=$(''+table.replace('style="','style="position:absolute;'+pos+";")+"
").appendTo(placeholder);if(0!=options.legend.backgroundOpacity){var c=options.legend.backgroundColor;null==c&&(c=options.grid.backgroundColor,c=c&&"string"==typeof c?$.color.parse(c):$.color.extract(legend,"background-color"),c.a=1,c=c.toString());var div=legend.children();$('
').prependTo(legend).css("opacity",options.legend.backgroundOpacity)}}}}}function findNearbyItem(mouseX,mouseY,seriesFilter){var i,j,ps,maxDistance=options.grid.mouseActiveRadius,smallestDistance=maxDistance*maxDistance+1,item=null;for(i=series.length-1;i>=0;--i)if(seriesFilter(series[i])){var s=series[i],axisx=s.xaxis,axisy=s.yaxis,points=s.datapoints.points,mx=axisx.c2p(mouseX),my=axisy.c2p(mouseY),maxx=maxDistance/axisx.scale,maxy=maxDistance/axisy.scale;if(ps=s.datapoints.pointsize,axisx.options.inverseTransform&&(maxx=Number.MAX_VALUE),axisy.options.inverseTransform&&(maxy=Number.MAX_VALUE),s.lines.show||s.points.show)for(j=0;jmaxx||-maxx>x-mx||y-my>maxy||-maxy>y-my)){var dx=Math.abs(axisx.p2c(x)-mouseX),dy=Math.abs(axisy.p2c(y)-mouseY),dist=dx*dx+dy*dy;smallestDistance>dist&&(smallestDistance=dist,item=[i,j/ps])}}if(s.bars.show&&!item){var barLeft="left"==s.bars.align?0:-s.bars.barWidth/2,barRight=barLeft+s.bars.barWidth;for(j=0;j=Math.min(b,x)&&my>=y+barLeft&&y+barRight>=my:mx>=x+barLeft&&x+barRight>=mx&&my>=Math.min(b,y)&&my<=Math.max(b,y))&&(item=[i,j/ps])}}}return item?(i=item[0],j=item[1],ps=series[i].datapoints.pointsize,{datapoint:series[i].datapoints.points.slice(j*ps,(j+1)*ps),dataIndex:j,series:series[i],seriesIndex:i}):null}function onMouseMove(e){options.grid.hoverable&&triggerClickHoverEvent("plothover",e,function(s){return 0!=s.hoverable})}function onMouseLeave(e){options.grid.hoverable&&triggerClickHoverEvent("plothover",e,function(s){return!1})}function onClick(e){triggerClickHoverEvent("plotclick",e,function(s){return 0!=s.clickable})}function triggerClickHoverEvent(eventname,event,seriesFilter){var offset=eventHolder.offset(),canvasX=event.pageX-offset.left-plotOffset.left,canvasY=event.pageY-offset.top-plotOffset.top,pos=canvasToAxisCoords({left:canvasX,top:canvasY});pos.pageX=event.pageX,pos.pageY=event.pageY;var item=findNearbyItem(canvasX,canvasY,seriesFilter);if(item&&(item.pageX=parseInt(item.series.xaxis.p2c(item.datapoint[0])+offset.left+plotOffset.left,10),item.pageY=parseInt(item.series.yaxis.p2c(item.datapoint[1])+offset.top+plotOffset.top,10)),options.grid.autoHighlight){for(var i=0;iaxisx.max||yaxisy.max)){var pointRadius=series.points.radius+series.points.lineWidth/2;octx.lineWidth=pointRadius,octx.strokeStyle=highlightColor;var radius=1.5*pointRadius;x=axisx.p2c(x),y=axisy.p2c(y),octx.beginPath(),"circle"==series.points.symbol?octx.arc(x,y,radius,0,2*Math.PI,!1):series.points.symbol(octx,x,y,radius,!1),octx.closePath(),octx.stroke()}}function drawBarHighlight(series,point){var highlightColor="string"==typeof series.highlightColor?series.highlightColor:$.color.parse(series.color).scale("a",.5).toString(),fillStyle=highlightColor,barLeft="left"==series.bars.align?0:-series.bars.barWidth/2;octx.lineWidth=series.bars.lineWidth,octx.strokeStyle=highlightColor,drawBar(point[0],point[1],point[2]||0,barLeft,barLeft+series.bars.barWidth,0,function(){return fillStyle},series.xaxis,series.yaxis,octx,series.bars.horizontal,series.bars.lineWidth)}function getColorOrGradient(spec,bottom,top,defaultColor){if("string"==typeof spec)return spec;for(var gradient=ctx.createLinearGradient(0,top,0,bottom),i=0,l=spec.colors.length;l>i;++i){var c=spec.colors[i];if("string"!=typeof c){var co=$.color.parse(defaultColor);null!=c.brightness&&(co=co.scale("rgb",c.brightness)),null!=c.opacity&&(co.a*=c.opacity),c=co.toString()}gradient.addColorStop(i/(l-1),c)}return gradient}var series=[],options={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:!0,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:.85,sorted:null},xaxis:{show:null,position:"bottom",mode:null,font:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null},yaxis:{autoscaleMargin:.02,position:"left"},xaxes:[],yaxes:[],series:{points:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:2,fill:!1,fillColor:null,steps:!1},bars:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,align:"left",horizontal:!1,zero:!0},shadowSize:3,highlightColor:null},grid:{show:!0,aboveData:!1,color:"#545454",backgroundColor:null,borderColor:null,tickColor:null,margin:0,labelMargin:5,axisMargin:8,borderWidth:2,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:!1,hoverable:!1,autoHighlight:!0,mouseActiveRadius:10},interaction:{redrawOverlayInterval:1e3/60},hooks:{}},surface=null,overlay=null,eventHolder=null,ctx=null,octx=null,xaxes=[],yaxes=[],plotOffset={left:0,right:0,top:0,bottom:0},plotWidth=0,plotHeight=0,hooks={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],drawBackground:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},plot=this;plot.setData=setData,plot.setupGrid=setupGrid,plot.draw=draw,plot.getPlaceholder=function(){return placeholder},plot.getCanvas=function(){return surface.element},plot.getPlotOffset=function(){return plotOffset},plot.width=function(){return plotWidth},plot.height=function(){return plotHeight},plot.offset=function(){var o=eventHolder.offset();return o.left+=plotOffset.left,o.top+=plotOffset.top,o},plot.getData=function(){return series},plot.getAxes=function(){var res={};return $.each(xaxes.concat(yaxes),function(_,axis){axis&&(res[axis.direction+(1!=axis.n?axis.n:"")+"axis"]=axis)}),res},plot.getXAxes=function(){return xaxes},plot.getYAxes=function(){return yaxes},plot.c2p=canvasToAxisCoords,plot.p2c=axisToCanvasCoords,plot.getOptions=function(){return options},plot.highlight=highlight,plot.unhighlight=unhighlight,plot.triggerRedrawOverlay=triggerRedrawOverlay,plot.pointOffset=function(point){return{left:parseInt(xaxes[axisNumber(point,"x")-1].p2c(+point.x)+plotOffset.left,10),top:parseInt(yaxes[axisNumber(point,"y")-1].p2c(+point.y)+plotOffset.top,10)}},plot.shutdown=shutdown,plot.resize=function(){var width=placeholder.width(),height=placeholder.height();surface.resize(width,height),overlay.resize(width,height)},plot.hooks=hooks,initPlugins(plot),parseOptions(options_),setupCanvases(),setData(data_),setupGrid(),draw(),bindEvents();var highlights=[],redrawTimeout=null}function floorInBase(n,base){return base*Math.floor(n/base)}var hasOwnProperty=Object.prototype.hasOwnProperty;Canvas.prototype.resize=function(width,height){if(0>=width||0>=height)throw new Error("Invalid dimensions for plot, width = "+width+", height = "+height);var element=this.element,context=this.context,pixelRatio=this.pixelRatio;this.width!=width&&(element.width=width*pixelRatio,element.style.width=width+"px",this.width=width),this.height!=height&&(element.height=height*pixelRatio,element.style.height=height+"px",this.height=height),context.restore(),context.save(),context.scale(pixelRatio,pixelRatio)},Canvas.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},Canvas.prototype.render=function(){var cache=this._textCache;for(var layerKey in cache)if(hasOwnProperty.call(cache,layerKey)){var layer=this.getTextLayer(layerKey),layerCache=cache[layerKey];layer.hide();for(var styleKey in layerCache)if(hasOwnProperty.call(layerCache,styleKey)){var styleCache=layerCache[styleKey];for(var key in styleCache)if(hasOwnProperty.call(styleCache,key)){for(var position,positions=styleCache[key].positions,i=0;position=positions[i];i++)position.active?position.rendered||(layer.append(position.element),position.rendered=!0):(positions.splice(i--,1),position.rendered&&position.element.detach());0==positions.length&&delete styleCache[key]}}layer.show()}},Canvas.prototype.getTextLayer=function(classes){var layer=this.text[classes];return null==layer&&(null==this.textContainer&&(this.textContainer=$("
").css({position:"absolute",top:0,left:0,bottom:0,right:0,"font-size":"smaller",color:"#545454"}).insertAfter(this.element)),layer=this.text[classes]=$("
").addClass(classes).css({position:"absolute",top:0,left:0,bottom:0,right:0}).appendTo(this.textContainer)),layer},Canvas.prototype.getTextInfo=function(layer,text,font,angle,width){var textStyle,layerCache,styleCache,info;if(text=""+text,textStyle="object"==typeof font?font.style+" "+font.variant+" "+font.weight+" "+font.size+"px/"+font.lineHeight+"px "+font.family:font,layerCache=this._textCache[layer],null==layerCache&&(layerCache=this._textCache[layer]={}),styleCache=layerCache[textStyle],null==styleCache&&(styleCache=layerCache[textStyle]={}),info=styleCache[text],null==info){var element=$("
").html(text).css({position:"absolute","max-width":width,top:-9999}).appendTo(this.getTextLayer(layer));"object"==typeof font?element.css({font:textStyle,color:font.color}):"string"==typeof font&&element.addClass(font),info=styleCache[text]={width:element.outerWidth(!0),height:element.outerHeight(!0),element:element,positions:[]},element.detach()}return info},Canvas.prototype.addText=function(layer,x,y,text,font,angle,width,halign,valign){var info=this.getTextInfo(layer,text,font,angle,width),positions=info.positions;"center"==halign?x-=info.width/2:"right"==halign&&(x-=info.width),"middle"==valign?y-=info.height/2:"bottom"==valign&&(y-=info.height);for(var position,i=0;position=positions[i];i++)if(position.x==x&&position.y==y)return void(position.active=!0);position={active:!0,rendered:!1,element:positions.length?info.element.clone():info.element,x:x,y:y},positions.push(position),position.element.css({top:Math.round(y),left:Math.round(x),"text-align":halign})},Canvas.prototype.removeText=function(layer,x,y,text,font,angle){if(null==text){var layerCache=this._textCache[layer];if(null!=layerCache)for(var styleKey in layerCache)if(hasOwnProperty.call(layerCache,styleKey)){var styleCache=layerCache[styleKey];for(var key in styleCache)if(hasOwnProperty.call(styleCache,key))for(var position,positions=styleCache[key].positions,i=0;position=positions[i];i++)position.active=!1}}else for(var position,positions=this.getTextInfo(layer,text,font,angle).positions,i=0;position=positions[i];i++)position.x==x&&position.y==y&&(position.active=!1)},$.plot=function(placeholder,data,options){var plot=new Plot($(placeholder),data,options,$.plot.plugins);return plot},$.plot.version="0.8.1",$.plot.plugins=[],$.fn.plot=function(data,options){return this.each(function(){$.plot(this,data,options)})}}(jQuery),function($){function init(plot){plot.hooks.drawSeries.push(function(plot,ctx,series){function plotDashes(xoffset,yoffset){function lineSegmentOffset(segmentLength){var c=Math.sqrt(Math.pow(ax2-ax1,2)+Math.pow(ay2-ay1,2));if(segmentLength>=c)return{deltaX:ax2-ax1,deltaY:ay2-ay1,distance:c,remainder:segmentLength-c};var xsign=ax2>ax1?1:-1,ysign=ay2>ay1?1:-1;return{deltaX:xsign*Math.sqrt(Math.pow(segmentLength,2)/(1+Math.pow((ay2-ay1)/(ax2-ax1),2))),deltaY:ysign*Math.sqrt(Math.pow(segmentLength,2)-Math.pow(segmentLength,2)/(1+Math.pow((ay2-ay1)/(ax2-ax1),2))),distance:segmentLength,remainder:0}}var dashOnLength,dashOffLength,points=series.datapoints.points,ps=series.datapoints.pointsize,prevx=null,prevy=null,dashRemainder=0,dashOn=!0;series.dashes.dashLength[0]?(dashOnLength=series.dashes.dashLength[0],dashOffLength=series.dashes.dashLength[1]?series.dashes.dashLength[1]:dashOnLength):dashOffLength=dashOnLength=series.dashes.dashLength,ctx.beginPath();for(var i=ps;i=y1&&y1=y2&&y2=y2&&y1>axisy.max){if(y2>axisy.max)continue;x1=(axisy.max-y1)/(y2-y1)*(x2-x1)+x1,y1=axisy.max}else if(y2>=y1&&y2>axisy.max){if(y1>axisy.max)continue;x2=(axisy.max-y1)/(y2-y1)*(x2-x1)+x1,y2=axisy.max}if(x2>=x1&&x1=x2&&x2=x2&&x1>axisx.max){if(x2>axisx.max)continue;y1=(axisx.max-x1)/(x2-x1)*(y2-y1)+y1,x1=axisx.max}else if(x2>=x1&&x2>axisx.max){if(x1>axisx.max)continue;y2=(axisx.max-x1)/(x2-x1)*(y2-y1)+y1,x2=axisx.max}(x1!=prevx||y1!=prevy)&&ctx.moveTo(axisx.p2c(x1)+xoffset,axisy.p2c(y1)+yoffset);var dashOffset,ax1=axisx.p2c(x1)+xoffset,ay1=axisy.p2c(y1)+yoffset,ax2=axisx.p2c(x2)+xoffset,ay2=axisy.p2c(y2)+yoffset;do dashOffset=lineSegmentOffset(dashRemainder>0?dashRemainder:dashOn?dashOnLength:dashOffLength),(0!=dashOffset.deltaX||0!=dashOffset.deltaY)&&(dashOn?ctx.lineTo(ax1+dashOffset.deltaX,ay1+dashOffset.deltaY):ctx.moveTo(ax1+dashOffset.deltaX,ay1+dashOffset.deltaY)),dashOn=!dashOn,dashRemainder=dashOffset.remainder,ax1+=dashOffset.deltaX,ay1+=dashOffset.deltaY;while(dashOffset.distance>0);prevx=x2,prevy=y2}}ctx.stroke()}if(series.dashes.show){var plotOffset=plot.getPlotOffset(),axisx=series.xaxis,axisy=series.yaxis;ctx.save(),ctx.translate(plotOffset.left,plotOffset.top),ctx.lineJoin="round";var lw=series.dashes.lineWidth,sw=series.shadowSize;if(lw>0&&sw>0){ctx.lineWidth=sw,ctx.strokeStyle="rgba(0,0,0,0.1)";var angle=Math.PI/18;plotDashes(Math.sin(angle)*(lw/2+sw/2),Math.cos(angle)*(lw/2+sw/2)),ctx.lineWidth=sw/2,plotDashes(Math.sin(angle)*(lw/2+sw/4),Math.cos(angle)*(lw/2+sw/4))}ctx.lineWidth=lw,ctx.strokeStyle=series.color,lw>0&&plotDashes(0,0),ctx.restore()}})}$.plot.plugins.push({init:init,options:{series:{dashes:{show:!1,lineWidth:2,dashLength:10}}},name:"dashes",version:"0.1"})}(jQuery),function($){function floorInBase(n,base){return base*Math.floor(n/base)}function formatDate(d,fmt,monthNames,dayNames){if("function"==typeof d.strftime)return d.strftime(fmt);var leftPad=function(n,pad){return n=""+n,pad=""+(null==pad?"0":pad),1==n.length?pad+n:n},r=[],escape=!1,hours=d.getHours(),isAM=12>hours;null==monthNames&&(monthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),null==dayNames&&(dayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);var hours12;hours12=hours>12?hours-12:0==hours?12:hours;for(var i=0;i=minSize);++i);var size=spec[i][0],unit=spec[i][1];if("year"==unit){if(null!=opts.minTickSize&&"year"==opts.minTickSize[1])size=Math.floor(opts.minTickSize[0]);else{var magn=Math.pow(10,Math.floor(Math.log(axis.delta/timeUnitSize.year)/Math.LN10)),norm=axis.delta/timeUnitSize.year/magn;size=1.5>norm?1:3>norm?2:7.5>norm?5:10,size*=magn}1>size&&(size=1)}axis.tickSize=opts.tickSize||[size,unit];var tickSize=axis.tickSize[0];unit=axis.tickSize[1];var step=tickSize*timeUnitSize[unit];"second"==unit?d.setSeconds(floorInBase(d.getSeconds(),tickSize)):"minute"==unit?d.setMinutes(floorInBase(d.getMinutes(),tickSize)):"hour"==unit?d.setHours(floorInBase(d.getHours(),tickSize)):"month"==unit?d.setMonth(floorInBase(d.getMonth(),tickSize)):"quarter"==unit?d.setMonth(3*floorInBase(d.getMonth()/3,tickSize)):"year"==unit&&d.setFullYear(floorInBase(d.getFullYear(),tickSize)),d.setMilliseconds(0),step>=timeUnitSize.minute&&d.setSeconds(0),step>=timeUnitSize.hour&&d.setMinutes(0),step>=timeUnitSize.day&&d.setHours(0),step>=4*timeUnitSize.day&&d.setDate(1),step>=2*timeUnitSize.month&&d.setMonth(floorInBase(d.getMonth(),3)),step>=2*timeUnitSize.quarter&&d.setMonth(floorInBase(d.getMonth(),6)),step>=timeUnitSize.year&&d.setMonth(0);var prev,carry=0,v=Number.NaN;do if(prev=v,v=d.getTime(),ticks.push(v),"month"==unit||"quarter"==unit)if(1>tickSize){d.setDate(1);var start=d.getTime();d.setMonth(d.getMonth()+("quarter"==unit?3:1));var end=d.getTime();d.setTime(v+carry*timeUnitSize.hour+(end-start)*tickSize),carry=d.getHours(),d.setHours(0)}else d.setMonth(d.getMonth()+tickSize*("quarter"==unit?3:1));else"year"==unit?d.setFullYear(d.getFullYear()+tickSize):d.setTime(v+step);while(vvalue?min:value>max?max:value}function setSelectionPos(pos,e){var o=plot.getOptions(),offset=plot.getPlaceholder().offset(),plotOffset=plot.getPlotOffset();pos.x=clamp(0,e.pageX-offset.left-plotOffset.left,plot.width()),pos.y=clamp(0,e.pageY-offset.top-plotOffset.top,plot.height()),"y"==o.selection.mode&&(pos.x=pos==selection.first?0:plot.width()),"x"==o.selection.mode&&(pos.y=pos==selection.first?0:plot.height())}function updateSelection(pos){null!=pos.pageX&&(setSelectionPos(selection.second,pos),selectionIsSane()?(selection.show=!0,plot.triggerRedrawOverlay()):clearSelection(!0))}function clearSelection(preventEvent){selection.show&&(selection.show=!1,plot.triggerRedrawOverlay(),preventEvent||plot.getPlaceholder().trigger("plotunselected",[]))}function extractRange(ranges,coord){var axis,from,to,key,axes=plot.getAxes();for(var k in axes)if(axis=axes[k],axis.direction==coord&&(key=coord+axis.n+"axis",ranges[key]||1!=axis.n||(key=coord+"axis"),ranges[key])){from=ranges[key].from,to=ranges[key].to;break}if(ranges[key]||(axis="x"==coord?plot.getXAxes()[0]:plot.getYAxes()[0],from=ranges[coord+"1"],to=ranges[coord+"2"]),null!=from&&null!=to&&from>to){var tmp=from;from=to,to=tmp}return{from:from,to:to,axis:axis}}function setSelection(ranges,preventEvent){var range,o=plot.getOptions();"y"==o.selection.mode?(selection.first.x=0,selection.second.x=plot.width()):(range=extractRange(ranges,"x"),selection.first.x=range.axis.p2c(range.from),selection.second.x=range.axis.p2c(range.to)),"x"==o.selection.mode?(selection.first.y=0,selection.second.y=plot.height()):(range=extractRange(ranges,"y"),selection.first.y=range.axis.p2c(range.from),selection.second.y=range.axis.p2c(range.to)),selection.show=!0,plot.triggerRedrawOverlay(),!preventEvent&&selectionIsSane()&&triggerSelectedEvent()}function selectionIsSane(){var minSize=plot.getOptions().selection.minSize;return Math.abs(selection.second.x-selection.first.x)>=minSize&&Math.abs(selection.second.y-selection.first.y)>=minSize}var selection={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},savedhandlers={},mouseUpHandler=null;plot.clearSelection=clearSelection,plot.setSelection=setSelection,plot.getSelection=getSelection,plot.hooks.bindEvents.push(function(plot,eventHolder){var o=plot.getOptions();null!=o.selection.mode&&(eventHolder.mousemove(onMouseMove),eventHolder.mousedown(onMouseDown))}),plot.hooks.drawOverlay.push(function(plot,ctx){if(selection.show&&selectionIsSane()){var plotOffset=plot.getPlotOffset(),o=plot.getOptions();ctx.save(),ctx.translate(plotOffset.left,plotOffset.top);var c=$.color.parse(o.selection.color);ctx.strokeStyle=c.scale("a",.8).toString(),ctx.lineWidth=1,ctx.lineJoin=o.selection.shape,ctx.fillStyle=c.scale("a",.4).toString();var x=Math.min(selection.first.x,selection.second.x)+.5,y=Math.min(selection.first.y,selection.second.y)+.5,w=Math.abs(selection.second.x-selection.first.x)-1,h=Math.abs(selection.second.y-selection.first.y)-1;ctx.fillRect(x,y,w,h),ctx.strokeRect(x,y,w,h),ctx.restore()}}),plot.hooks.shutdown.push(function(plot,eventHolder){eventHolder.unbind("mousemove",onMouseMove),eventHolder.unbind("mousedown",onMouseDown),mouseUpHandler&&$(document).unbind("mouseup",mouseUpHandler)})}$.plot.plugins.push({init:init,options:{selection:{mode:null,color:"#e8cfac",shape:"round",minSize:5}},name:"selection",version:"1.1"})}(jQuery),function($,h,c){function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);(m!==o.w||l!==o.h)&&n.trigger(j,[o.w=m,o.h=l])}),g()},e[b])}var i,a=$([]),e=$.resize=$.extend($.resize,{}),k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250,e[f]=!0,$.event.special[j]={setup:function(){if(!e[f]&&this[k])return!1;var l=$(this);a=a.add(l),$.data(this,d,{w:l.width(),h:l.height()}),1===a.length&&g()},teardown:function(){if(!e[f]&&this[k])return!1;var l=$(this);a=a.not(l),l.removeData(d),a.length||clearTimeout(i)},add:function(l){function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width(),r.h=p!==c?p:q.height(),n.apply(this,arguments)}if(!e[f]&&this[k])return!1;var n;return $.isFunction(l)?(n=l,m):(n=l.handler,void(l.handler=m))}}}(jQuery,this),function($){function init(plot){function onResize(){var placeholder=plot.getPlaceholder();0!=placeholder.width()&&0!=placeholder.height()&&(plot.resize(),plot.setupGrid(),plot.draw())}function bindEvents(plot,eventHolder){plot.getPlaceholder().resize(onResize)}function shutdown(plot,eventHolder){plot.getPlaceholder().unbind("resize",onResize)}plot.hooks.bindEvents.push(bindEvents),plot.hooks.shutdown.push(shutdown)}var options={};$.plot.plugins.push({init:init,options:options,name:"resize",version:"1.0"})}(jQuery),$(document).ready(function(){function animateSection(sectionName,offset){$("html,body").animate({scrollTop:$(sectionName).offset().top+offset},750)}function switchStandardsList(el){standardsList.hide(),chosenValue=el.val(),$('[data-attr="'+chosenValue+'"]').show()}function getGraphData(){$($('[data-role="url-stats"]').get().reverse()).each(function(){var el=$(this);storeDatum(el,getXAxisLabel(el))})}function getXAxisLabel(el){return el.find('[data-role="date"]').attr("data-value")}function storeDatum(el,label){$.each(el.find("[data-label]"),function(){var type=$(this).attr("data-label"),value=$(this).html();"undefined"==typeof data[type]&&(data[type]=[]),data[type].push([label,+value])})}function plotGraphData(){$.plot(graphContainer,getData(),graphOptions)}function getData(){return[{color:"rgb(216, 61, 45)",label:"Errors",data:data.error},{color:"rgb(168, 103, 0)",label:"Warnings",data:data.warning,lines:{show:!1},dashes:{show:!0}},{color:"rgb(23, 123, 190)",label:"Notices",data:data.notice,lines:{show:!1},dashes:{show:!0,dashLength:5}}]}function toggleResetZoomButton(){zoomResetButton.toggleClass("hidden")}function plotAccordingToChoices(){var data=[];choiceContainer.find("input:checked").each(function(){var key=$(this).attr("name");key&&datasets[key]&&data.push(datasets[key])}),data.length>-1&&$.plot(graphContainer,data,graphOptions)}function showTooltip(x,y,contents){$('").css({top:y+5,left:x+5}).appendTo("body").fadeIn(200)}function initTaskFilter(container){var tasks=initTaskFilterTasks(container);initTaskFilterInput(container,tasks)}function initTaskFilterTasks(container){var tasks=container.find("[data-role=task]");return tasks}function initTaskFilterInput(container,tasks){var input=container.find("[data-role=input]");return input.on("keyup",function(){filterTasks(tasks,input.val())}),input}function filterTasks(tasks,query){if(query=$.trim(query.replace(/[^a-z0-9\s]+/gi,"")),tasks.removeClass("hidden"),!/^\s*$/.test(query)){var queryRegExp=new RegExp("("+query.replace(/\s+/gi,"|")+")","i");tasks.filter(function(){return!queryRegExp.test($(this).data("keywords"))}).addClass("hidden")}}var data={},standardsList=$('[data-role="standards-list"]'),standardSelect=$('[data-role="new-task-select"]'),expandLink=$('[data-role="expander"]'),taskListSelector=$('[data-role="task-list"] a'),toTopLinks=$('[data-role="top"]'),zoomResetButton=$('[data-role="zoom-reset"]'),graphContainer=$('[data-role="graph"]'),dateSelectDropdownMenu=$('[data-role="date-select-dropdown-menu"]'),graphOptions={series:{dashes:{show:!1,lineWidth:3},lines:{show:!0},points:{show:!0},hoverable:!0},xaxis:{mode:"time",tickLength:0,minTickSize:[1,"day"],timeformat:"%d %b"},yaxis:{tickDecimals:0},lines:{lineWidth:3},points:{fill:!0,fillColor:"rgb(255, 255, 255)"},shadowSize:0,grid:{backgroundColor:"#fff",borderColor:"#808080",hoverable:!0,clickable:!0,borderWidth:{top:1,right:1,bottom:1,left:1}},selection:{mode:"x"}};expandLink.click(function(){$(this).next().slideToggle("slow",function(){}),$(this).hasClass("showing")?($(this).find("span.expander").html("+"),$(this).attr("aria-expanded",!1)):($(this).find("span.expander").html("-"),$(this).attr("aria-expanded",!0)),$(this).toggleClass("showing")}),$(document).on("keydown.lists",'[data-role="expander"]',function(e){var $this=$(this),k=e.which||e.keyCode;/(13|32)/.test(k)&&((13===k||32===k)&&$this.click(),e.preventDefault(),e.stopPropagation())}),toTopLinks.click(function(e){e.preventDefault(),$(animateSection($("#top"),-55))}),switchStandardsList(standardSelect),$(".rules-list-title").addClass("hidden"),$(".date-links").removeClass("list-group date-links").addClass("dropdown-menu"),$(".dropdown-menu a").removeClass("list-group-item"),dateSelectDropdownMenu.removeClass("hidden"),standardSelect.change(function(){switchStandardsList($(this))}),taskListSelector.click(function(e){e.preventDefault(),target=$(this).attr("href"),animateSection($(target),-25),$(target).hasClass("showing")||$(target).click()}),zoomResetButton.click(function(){plotGraphData(),toggleResetZoomButton()}),$.each(graphContainer,function(){getGraphData(),plotGraphData()}),$('[data-role="rules-tooltip"]').tooltip(),graphContainer.bind("plotselected",function(event,ranges){ranges.xaxis.to-ranges.xaxis.from<1e-5&&(ranges.xaxis.to=ranges.xaxis.from+1e-5),ranges.yaxis.to-ranges.yaxis.from<1e-5&&(ranges.yaxis.to=ranges.yaxis.from+1e-5),plot=$.plot(graphContainer,getData(ranges.xaxis.from,ranges.xaxis.to),$.extend(!0,{},graphOptions,{xaxis:{min:ranges.xaxis.from,max:ranges.xaxis.to},yaxis:{min:ranges.yaxis.from,max:ranges.yaxis.to}})),zoomResetButton.is(":visible")||toggleResetZoomButton()});var choiceContainer=$('[data-role="series-checkboxes"]'),datasets=getData();$.each(datasets,function(key,val){var lowerCaseValue=val.label.substring(0,val.label.length-1).toLowerCase();choiceContainer.append(''+val.label+"
")}),choiceContainer.find("input").click(plotAccordingToChoices),choiceContainer.find("[data-stat-type=errors]").click();var previousPoint=null;graphContainer.bind("plothover",function(event,pos,item){if(item){if(previousPoint!=item.dataIndex){previousPoint=item.dataIndex,$('[data-role="tooltip"]').remove();var count=item.datapoint[1].toFixed(0),date=$.plot.formatDate(new Date(item.datapoint[0]),"%d %b (%H:%M) "),contents=''+date+" "+count+" "+item.series.label+"[h6]>";showTooltip(item.pageX,item.pageY,contents)}}else $('[data-role="tooltip"]').remove(),previousPoint=null});var taskLists=$("[data-control=task-list]");taskLists.length>0&&$("[data-control=task-list]").each(function(){initTaskFilter($(this))}),$.fn.collapse.Constructor.prototype.keydown=function(e){var $this=$(this),k=e.which||e.keyCode;/(13|32)/.test(k)&&((13===k||32===k)&&$this.click(),e.preventDefault(),e.stopPropagation())},$('[data-toggle="collapse"]').attr("role","button").attr("tabindex",0),$(document).on("keydown.collapse.data-api",'[data-toggle="collapse"]',$.fn.collapse.Constructor.prototype.keydown)});
\ No newline at end of file
diff --git a/public/js/vendor/flot/jquery.flot.dashes.js b/public/js/vendor/flot/jquery.flot.dashes.js
new file mode 100644
index 0000000..f18ab9c
--- /dev/null
+++ b/public/js/vendor/flot/jquery.flot.dashes.js
@@ -0,0 +1,228 @@
+/*
+ * jQuery.flot.dashes
+ *
+ * options = {
+ * series: {
+ * dashes: {
+ *
+ * // show
+ * // default: false
+ * // Whether to show dashes for the series.
+ * show: ,
+ *
+ * // lineWidth
+ * // default: 2
+ * // The width of the dashed line in pixels.
+ * lineWidth: ,
+ *
+ * // dashLength
+ * // default: 10
+ * // Controls the length of the individual dashes and the amount of
+ * // space between them.
+ * // If this is a number, the dashes and spaces will have that length.
+ * // If this is an array, it is read as [ dashLength, spaceLength ]
+ * dashLength: or
+ * }
+ * }
+ * }
+ */
+(function($){
+
+ function init(plot) {
+ plot.hooks.drawSeries.push(function(plot, ctx, series) {
+ if (!series.dashes.show) return;
+
+ var plotOffset = plot.getPlotOffset(),
+ axisx = series.xaxis,
+ axisy = series.yaxis;
+
+ function plotDashes(xoffset, yoffset) {
+
+ var points = series.datapoints.points,
+ ps = series.datapoints.pointsize,
+ prevx = null,
+ prevy = null,
+ dashRemainder = 0,
+ dashOn = true,
+ dashOnLength,
+ dashOffLength;
+
+ if (series.dashes.dashLength[0]) {
+ dashOnLength = series.dashes.dashLength[0];
+ if (series.dashes.dashLength[1]) {
+ dashOffLength = series.dashes.dashLength[1];
+ } else {
+ dashOffLength = dashOnLength;
+ }
+ } else {
+ dashOffLength = dashOnLength = series.dashes.dashLength;
+ }
+
+ ctx.beginPath();
+
+ for (var i = ps; i < points.length; i += ps) {
+
+ var x1 = points[i - ps],
+ y1 = points[i - ps + 1],
+ x2 = points[i],
+ y2 = points[i + 1];
+
+ if (x1 == null || x2 == null) continue;
+
+ // clip with ymin
+ if (y1 <= y2 && y1 < axisy.min) {
+ if (y2 < axisy.min) continue; // line segment is outside
+ // compute new intersection point
+ x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y1 = axisy.min;
+ } else if (y2 <= y1 && y2 < axisy.min) {
+ if (y1 < axisy.min) continue;
+ x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y2 = axisy.min;
+ }
+
+ // clip with ymax
+ if (y1 >= y2 && y1 > axisy.max) {
+ if (y2 > axisy.max) continue;
+ x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y1 = axisy.max;
+ } else if (y2 >= y1 && y2 > axisy.max) {
+ if (y1 > axisy.max) continue;
+ x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y2 = axisy.max;
+ }
+
+ // clip with xmin
+ if (x1 <= x2 && x1 < axisx.min) {
+ if (x2 < axisx.min) continue;
+ y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x1 = axisx.min;
+ } else if (x2 <= x1 && x2 < axisx.min) {
+ if (x1 < axisx.min) continue;
+ y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x2 = axisx.min;
+ }
+
+ // clip with xmax
+ if (x1 >= x2 && x1 > axisx.max) {
+ if (x2 > axisx.max) continue;
+ y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x1 = axisx.max;
+ } else if (x2 >= x1 && x2 > axisx.max) {
+ if (x1 > axisx.max) continue;
+ y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x2 = axisx.max;
+ }
+
+ if (x1 != prevx || y1 != prevy) {
+ ctx.moveTo(axisx.p2c(x1) + xoffset, axisy.p2c(y1) + yoffset);
+ }
+
+ var ax1 = axisx.p2c(x1) + xoffset,
+ ay1 = axisy.p2c(y1) + yoffset,
+ ax2 = axisx.p2c(x2) + xoffset,
+ ay2 = axisy.p2c(y2) + yoffset,
+ dashOffset;
+
+ function lineSegmentOffset(segmentLength) {
+
+ var c = Math.sqrt(Math.pow(ax2 - ax1, 2) + Math.pow(ay2 - ay1, 2));
+
+ if (c <= segmentLength) {
+ return {
+ deltaX: ax2 - ax1,
+ deltaY: ay2 - ay1,
+ distance: c,
+ remainder: segmentLength - c
+ }
+ } else {
+ var xsign = ax2 > ax1 ? 1 : -1,
+ ysign = ay2 > ay1 ? 1 : -1;
+ return {
+ deltaX: xsign * Math.sqrt(Math.pow(segmentLength, 2) / (1 + Math.pow((ay2 - ay1)/(ax2 - ax1), 2))),
+ deltaY: ysign * Math.sqrt(Math.pow(segmentLength, 2) - Math.pow(segmentLength, 2) / (1 + Math.pow((ay2 - ay1)/(ax2 - ax1), 2))),
+ distance: segmentLength,
+ remainder: 0
+ };
+ }
+ }
+ //-end lineSegmentOffset
+
+ do {
+
+ dashOffset = lineSegmentOffset(
+ dashRemainder > 0 ? dashRemainder :
+ dashOn ? dashOnLength : dashOffLength);
+
+ if (dashOffset.deltaX != 0 || dashOffset.deltaY != 0) {
+ if (dashOn) {
+ ctx.lineTo(ax1 + dashOffset.deltaX, ay1 + dashOffset.deltaY);
+ } else {
+ ctx.moveTo(ax1 + dashOffset.deltaX, ay1 + dashOffset.deltaY);
+ }
+ }
+
+ dashOn = !dashOn;
+ dashRemainder = dashOffset.remainder;
+ ax1 += dashOffset.deltaX;
+ ay1 += dashOffset.deltaY;
+
+ } while (dashOffset.distance > 0);
+
+ prevx = x2;
+ prevy = y2;
+ }
+
+ ctx.stroke();
+ }
+ //-end plotDashes
+
+ ctx.save();
+ ctx.translate(plotOffset.left, plotOffset.top);
+ ctx.lineJoin = 'round';
+
+ var lw = series.dashes.lineWidth,
+ sw = series.shadowSize;
+
+ // FIXME: consider another form of shadow when filling is turned on
+ if (lw > 0 && sw > 0) {
+ // draw shadow as a thick and thin line with transparency
+ ctx.lineWidth = sw;
+ ctx.strokeStyle = "rgba(0,0,0,0.1)";
+ // position shadow at angle from the mid of line
+ var angle = Math.PI/18;
+ plotDashes(Math.sin(angle) * (lw/2 + sw/2), Math.cos(angle) * (lw/2 + sw/2));
+ ctx.lineWidth = sw/2;
+ plotDashes(Math.sin(angle) * (lw/2 + sw/4), Math.cos(angle) * (lw/2 + sw/4));
+ }
+
+ ctx.lineWidth = lw;
+ ctx.strokeStyle = series.color;
+
+ if (lw > 0) {
+ plotDashes(0, 0);
+ }
+
+ ctx.restore();
+
+ });
+ //-end draw hook
+ }
+ //-end init
+
+ $.plot.plugins.push({
+ init: init,
+ options: {
+ series: {
+ dashes: {
+ show: false,
+ lineWidth: 2,
+ dashLength: 10
+ }
+ }
+ },
+ name: 'dashes',
+ version: '0.1'
+ });
+
+})(jQuery)