# HG changeset patch # User Thierry Florac # Date 1607683523 -3600 # Node ID f695c11dcd2de70ac05e70217ecc6fad3a9c530c # Parent 41732eb0701af51ca01a67220cfe7352331dbab9 Flot upgrade to 4.2.1 (with modifications!) diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.canvaswrapper.js --- a/src/myams/resources/js/ext/flot/jquery.canvaswrapper.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.canvaswrapper.js Fri Dec 11 11:45:23 2020 +0100 @@ -386,7 +386,6 @@ y += 0.75 * info.height; - // Determine whether this text already exists at this position. // If so, mark it for inclusion in the next render pass. @@ -447,7 +446,7 @@ position.element.style.textAlign = halign; // update the transforms updateTransforms(position.element, transforms); - }; + }; var addTspanElements = function(text, element, x) { var lines = text.split('
'), @@ -461,7 +460,7 @@ tspan = element.childNodes[i]; } tspan.textContent = lines[i]; - offset = i * 1 + 'em'; + offset = (i === 0 ? 0 : 1) + 'em'; tspan.setAttributeNS(null, 'dy', offset); tspan.setAttributeNS(null, 'x', x); } diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.canvaswrapper.min.js --- a/src/myams/resources/js/ext/flot/jquery.canvaswrapper.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.canvaswrapper.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -!function(t){var e=function(e,i){var n=i.getElementsByClassName(e)[0];if(!n&&((n=document.createElement("canvas")).className=e,n.style.direction="ltr",n.style.position="absolute",n.style.left="0px",n.style.top="0px",i.appendChild(n),!n.getContext))throw new Error("Canvas is not available.");this.element=n;var r=this.context=n.getContext("2d");this.pixelRatio=t.plot.browser.getPixelRatio(r);var l=t(i).width(),o=t(i).height();this.resize(l,o),this.SVGContainer=null,this.SVG={},this._textCache={}};function i(t,e){t.transform.baseVal.clear(),e&&e.forEach((function(e){t.transform.baseVal.appendItem(e)}))}e.prototype.resize=function(t,e){t=t<10?10:t,e=e<10?10:e;var i=this.element,n=this.context,r=this.pixelRatio;this.width!==t&&(i.width=t*r,i.style.width=t+"px",this.width=t),this.height!==e&&(i.height=e*r,i.style.height=e+"px",this.height=e),n.restore(),n.save(),n.scale(r,r)},e.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},e.prototype.render=function(){var t=this._textCache;for(var e in t)if(hasOwnProperty.call(t,e)){var i=this.getSVGLayer(e),n=t[e],r=i.style.display;for(var l in i.style.display="none",n)if(hasOwnProperty.call(n,l)){var o=n[l];for(var s in o)if(hasOwnProperty.call(o,s)){for(var a,h=o[s],d=h.positions,p=0;d[p];p++)if((a=d[p]).active)a.rendered||(i.appendChild(a.element),a.rendered=!0);else if(d.splice(p--,1),a.rendered){for(;a.element.firstChild;)a.element.removeChild(a.element.firstChild);a.element.parentNode.removeChild(a.element)}0===d.length&&(h.measured?h.measured=!1:delete o[s])}}i.style.display=r}},e.prototype.getSVGLayer=function(t){var e,i=this.SVG[t];i||(this.SVGContainer?e=this.SVGContainer.firstChild:(this.SVGContainer=document.createElement("div"),this.SVGContainer.className="flot-svg",this.SVGContainer.style.position="absolute",this.SVGContainer.style.top="0px",this.SVGContainer.style.left="0px",this.SVGContainer.style.height="100%",this.SVGContainer.style.width="100%",this.SVGContainer.style.pointerEvents="none",this.element.parentNode.appendChild(this.SVGContainer),(e=document.createElementNS("http://www.w3.org/2000/svg","svg")).style.width="100%",e.style.height="100%",this.SVGContainer.appendChild(e)),(i=document.createElementNS("http://www.w3.org/2000/svg","g")).setAttribute("class",t),i.style.position="absolute",i.style.top="0px",i.style.left="0px",i.style.bottom="0px",i.style.right="0px",e.appendChild(i),this.SVG[t]=i);return i},e.prototype.getTextInfo=function(t,e,i,r,l){var o,s,a,h;e=""+e,o="object"==typeof i?i.style+" "+i.variant+" "+i.weight+" "+i.size+"px/"+i.lineHeight+"px "+i.family:i,null==(s=this._textCache[t])&&(s=this._textCache[t]={}),null==(a=s[o])&&(a=s[o]={});var d=function(t){return t.replace(/0|1|2|3|4|5|6|7|8|9/g,"0")}(e);if(!(h=a[d])){var p=document.createElementNS("http://www.w3.org/2000/svg","text");if(-1!==e.indexOf("
"))n(e,p,-9999);else{var c=document.createTextNode(e);p.appendChild(c)}p.style.position="absolute",p.style.maxWidth=l,p.setAttributeNS(null,"x",-9999),p.setAttributeNS(null,"y",-9999),"object"==typeof i?(p.style.font=o,p.style.fill=i.fill):"string"==typeof i&&p.setAttribute("class",i),this.getSVGLayer(t).appendChild(p);var f=p.getBBox();for(h=a[d]={width:f.width,height:f.height,measured:!0,element:p,positions:[]};p.firstChild;)p.removeChild(p.firstChild);p.parentNode.removeChild(p)}return h.measured=!0,h},e.prototype.addText=function(t,e,r,l,o,s,a,h,d,p){var c=this.getTextInfo(t,l,o,s,a),f=c.positions;"center"===h?e-=c.width/2:"right"===h&&(e-=c.width),"middle"===d?r-=c.height/2:"bottom"===d&&(r-=c.height),r+=.75*c.height;for(var y,m=0;f[m];m++){if((y=f[m]).x===e&&y.y===r&&y.text===l)return y.active=!0,void i(y.element,p);if(!1===y.active)return y.active=!0,y.text=l,-1!==l.indexOf("
")?(r-=.25*c.height,n(l,y.element,e)):y.element.textContent=l,y.element.setAttributeNS(null,"x",e),y.element.setAttributeNS(null,"y",r),y.x=e,y.y=r,void i(y.element,p)}y={active:!0,rendered:!1,element:f.length?c.element.cloneNode():c.element,text:l,x:e,y:r},f.push(y),-1!==l.indexOf("
")?(r-=.25*c.height,n(l,y.element,e)):y.element.textContent=l,y.element.setAttributeNS(null,"x",e),y.element.setAttributeNS(null,"y",r),y.element.style.textAlign=h,i(y.element,p)};var n=function(t,e,i){var n,r,l,o=t.split("
");for(r=0;r"))n(e,p,-9999);else{var c=document.createTextNode(e);p.appendChild(c)}p.style.position="absolute",p.style.maxWidth=l,p.setAttributeNS(null,"x",-9999),p.setAttributeNS(null,"y",-9999),"object"==typeof i?(p.style.font=o,p.style.fill=i.fill):"string"==typeof i&&p.setAttribute("class",i),this.getSVGLayer(t).appendChild(p);var f=p.getBBox();for(h=a[d]={width:f.width,height:f.height,measured:!0,element:p,positions:[]};p.firstChild;)p.removeChild(p.firstChild);p.parentNode.removeChild(p)}return h.measured=!0,h},e.prototype.addText=function(t,e,r,l,o,s,a,h,d,p){var c=this.getTextInfo(t,l,o,s,a),f=c.positions;"center"===h?e-=c.width/2:"right"===h&&(e-=c.width),"middle"===d?r-=c.height/2:"bottom"===d&&(r-=c.height),r+=.75*c.height;for(var y,m=0;f[m];m++){if((y=f[m]).x===e&&y.y===r&&y.text===l)return y.active=!0,void i(y.element,p);if(!1===y.active)return y.active=!0,y.text=l,-1!==l.indexOf("
")?(r-=.25*c.height,n(l,y.element,e)):y.element.textContent=l,y.element.setAttributeNS(null,"x",e),y.element.setAttributeNS(null,"y",r),y.x=e,y.y=r,void i(y.element,p)}y={active:!0,rendered:!1,element:f.length?c.element.cloneNode():c.element,text:l,x:e,y:r},f.push(y),-1!==l.indexOf("
")?(r-=.25*c.height,n(l,y.element,e)):y.element.textContent=l,y.element.setAttributeNS(null,"x",e),y.element.setAttributeNS(null,"y",r),y.element.style.textAlign=h,i(y.element,p)};var n=function(t,e,i){var n,r,l,o=t.split("
");for(r=0;r p1 and p1 -> mp x2 = x1; @@ -202,7 +202,7 @@ continue; } - if(steps){ + if (steps) { if (mx !== null && my !== null) { // if middle point exists, transfer p2 -> p1 and p1 -> mp x2 = x1; @@ -482,8 +482,7 @@ drawLeft = true; drawRight = false; } - } - else { + } else { drawLeft = drawRight = drawTop = true; drawBottom = false; left = x + barLeft; @@ -587,7 +586,7 @@ var points = datapoints.points, ps = datapoints.pointsize, fillTowards = series.bars.fillTowards || 0, - calculatedBottom = fillTowards > axisy.min ? Math.min(axisy.max, fillTowards) : axisy.min; + defaultBottom = fillTowards > axisy.min ? Math.min(axisy.max, fillTowards) : axisy.min; for (var i = 0; i < points.length; i += ps) { if (points[i] == null) { @@ -595,7 +594,7 @@ } // Use third point as bottom if pointsize is 3 - var bottom = ps === 3 ? points[i + 2] : calculatedBottom; + var bottom = ps === 3 ? points[i + 2] : defaultBottom; drawBar(points[i], points[i + 1], bottom, barLeft, barRight, fillStyleCallback, axisx, axisy, ctx, series.bars.horizontal, series.bars.lineWidth); } } diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.fillbetween.js --- a/src/myams/resources/js/ext/flot/jquery.flot.fillbetween.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.fillbetween.js Fri Dec 11 11:45:23 2020 +0100 @@ -32,7 +32,7 @@ (function ($) { var options = { series: { - fillBetween: null // or number + fillBetween: null // or number } }; @@ -60,11 +60,11 @@ if (s.fillBetween == null) { return; } - - format = datapoints.format; + + var format = datapoints.format; var plotHasId = function(id) { var plotData = plot.getData(); - for (i = 0; i < plotData.length; i++) { + for (var i = 0; i < plotData.length; i++) { if (plotData[i].id === id) { return true; } @@ -76,17 +76,17 @@ if (!format) { format = []; - format.push({ - x: true, - number: true, + format.push({ + x: true, + number: true, computeRange: s.xaxis.options.autoScale !== 'none', - required: true + required: true }); - format.push({ - y: true, - number: true, + format.push({ + y: true, + number: true, computeRange: s.yaxis.options.autoScale !== 'none', - required: true + required: true }); if (s.fillBetween !== undefined && s.fillBetween !== '' && plotHasId(s.fillBetween) && s.fillBetween !== s.id) { diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.fillbetween.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.fillbetween.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.fillbetween.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -jQuery.plot.plugins.push({init:function(e){e.hooks.processRawData.push((function(e,n,t,l){null!=n.fillBetween&&(format=l.format,format||(format=[],format.push({x:!0,number:!0,computeRange:"none"!==n.xaxis.options.autoScale,required:!0}),format.push({y:!0,number:!0,computeRange:"none"!==n.yaxis.options.autoScale,required:!0}),void 0!==n.fillBetween&&""!==n.fillBetween&&function(n){var t=e.getData();for(i=0;i=n.length?null:n[e.fillBetween]:null}(n,e.getData());if(l){for(var i,o,f,u,s,r,a,p,h=t.pointsize,m=t.points,w=l.datapoints.pointsize,c=l.datapoints.points,g=[],B=n.lines.show,d=h>2&&t.format[2].y,y=B&&n.lines.steps,v=!0,x=0,b=0;!(x>=m.length);){if(a=g.length,null==m[x]){for(p=0;p=c.length){if(!B)for(p=0;pu){if(B&&x>0&&null!=m[x-h]){for(f=o+(m[x-h+1]-o)*(u-i)/(m[x-h]-i),g.push(u),g.push(f),p=2;p0&&null!=c[b-w]&&(r=s+(c[b-w+1]-s)*(i-u)/(c[b-w]-u)),x+=h}v=!1,a!==g.length&&d&&(g[a+2]=r)}if(y&&a!==g.length&&a>0&&null!==g[a]&&g[a]!==g[a-h]&&g[a+1]!==g[a-h+1]){for(p=0;p=n.length?null:n[e.fillBetween]:null}(n,e.getData());if(t){for(var i,o,u,s,f,r,a,p,h=l.pointsize,w=l.points,c=t.datapoints.pointsize,g=t.datapoints.points,B=[],m=n.lines.show,d=h>2&&l.format[2].y,v=m&&n.lines.steps,y=!0,x=0,b=0;!(x>=w.length);){if(a=B.length,null==w[x]){for(p=0;p=g.length){if(!m)for(p=0;ps){if(m&&x>0&&null!=w[x-h]){for(u=o+(w[x-h+1]-o)*(s-i)/(w[x-h]-i),B.push(s),B.push(u),p=2;p0&&null!=g[b-c]&&(r=f+(g[b-c+1]-f)*(i-s)/(g[b-c]-s)),x+=h}y=!1,a!==B.length&&d&&(B[a+2]=r)}if(v&&a!==B.length&&a>0&&null!==B[a]&&B[a]!==B[a-h]&&B[a+1]!==B[a-h+1]){for(p=0;p 0 - && series[0].xaxis.c2p !== undefined - && series[0].yaxis.c2p !== undefined) { + if (event !== undefined && + series.length > 0 && + series[0].xaxis.c2p !== undefined && + series[0].yaxis.c2p !== undefined) { var eventToTrigger = "plot" + eventType; var seriesFlag = eventType + "able"; triggerClickHoverEvent(eventToTrigger, event, @@ -152,17 +151,27 @@ pos.pageX = page.X; pos.pageY = page.Y; - var item = plot.findNearbyItem(canvasX, canvasY, seriesFilter, distance); + var items = plot.findNearbyItems(canvasX, canvasY, seriesFilter, distance); + var item = items[0]; + + for (let i = 1; i < items.length; ++i) { + if (item.distance === undefined || + items[i].distance < item.distance) { + item = items[i]; + } + } if (item) { // fill in mouse pos for any listeners out there item.pageX = parseInt(item.series.xaxis.p2c(item.datapoint[0]) + offset.left, 10); item.pageY = parseInt(item.series.yaxis.p2c(item.datapoint[1]) + offset.top, 10); + } else { + item = null; } if (options.grid.autoHighlight) { // clear auto-highlights - for (var i = 0; i < highlights.length; ++i) { + for (let i = 0; i < highlights.length; ++i) { var h = highlights[i]; if ((h.auto === eventname && !(item && h.series === item.series && @@ -177,7 +186,7 @@ } } - plot.getPlaceholder().trigger(eventname, [pos, item]); + plot.getPlaceholder().trigger(eventname, [pos, item, items]); } function highlight(s, point, auto) { diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.hover.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.hover.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.hover.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -!function(e){"use strict";var t=e.plot.browser,i={click:"click",hover:"hover"};e.plot.plugins.push({init:function(o){var r,a=[];function n(e){var t=o.getOptions(),r=new CustomEvent("mouseevent");return r.pageX=e.detail.changedTouches[0].pageX,r.pageY=e.detail.changedTouches[0].pageY,r.clientX=e.detail.changedTouches[0].clientX,r.clientY=e.detail.changedTouches[0].clientY,t.grid.hoverable&&s(r,i.hover,30),!1}function s(e,t,i){var r=o.getData();if(void 0!==e&&r.length>0&&void 0!==r[0].xaxis.c2p&&void 0!==r[0].yaxis.c2p){var a=t+"able";u("plot"+t,e,(function(e){return!1!==r[e][a]}),i)}}function l(e){r=e,o.getPlaceholder()[0].lastMouseMoveEvent=e,s(e,i.hover)}function c(e){r=void 0,o.getPlaceholder()[0].lastMouseMoveEvent=void 0,u("plothover",e,(function(e){return!1}))}function h(e){s(e,i.click)}function p(){o.unhighlight(),o.getPlaceholder().trigger("plothovercleanup")}function u(e,i,r,n){var s=o.getOptions(),l=o.offset(),c=t.getPageXY(i),h=c.X-l.left,p=c.Y-l.top,u=o.c2p({left:h,top:p}),v=void 0!==n?n:s.grid.mouseActiveRadius;u.pageX=c.X,u.pageY=c.Y;var f=o.findNearbyItem(h,p,r,v);if(f&&(f.pageX=parseInt(f.series.xaxis.p2c(f.datapoint[0])+l.left,10),f.pageY=parseInt(f.series.yaxis.p2c(f.datapoint[1])+l.top,10)),s.grid.autoHighlight){for(var b=0;bs.max||nl.max)){var h=t.points.radius+t.points.lineWidth/2;o.lineWidth=h,o.strokeStyle=c;var p=1.5*h;a=s.p2c(a),n=l.p2c(n),o.beginPath();var u=t.points.symbol;"circle"===u?o.arc(a,n,p,0,2*Math.PI,!1):"string"==typeof u&&r.drawSymbol&&r.drawSymbol[u]&&r.drawSymbol[u](o,a,n,p,!1),o.closePath(),o.stroke()}}function k(t,i,o){var r,a="string"==typeof t.highlightColor?t.highlightColor:e.color.parse(t.color).scale("a",.5).toString(),n=a,s=t.bars.barWidth[0]||t.bars.barWidth;switch(t.bars.align){case"left":r=0;break;case"right":r=-s;break;default:r=-s/2}o.lineWidth=t.bars.lineWidth,o.strokeStyle=a;var l=t.bars.fillTowards||0,c=l>t.yaxis.min?Math.min(t.yaxis.max,l):t.yaxis.min;e.plot.drawSeries.drawBar(i[0],i[1],i[2]||c,r,r+s,(function(){return n}),t.xaxis,t.yaxis,o,t.bars.horizontal,t.bars.lineWidth)}o.hooks.bindEvents.push((function(e,t){var i=e.getOptions();(i.grid.hoverable||i.grid.clickable)&&(t[0].addEventListener("touchevent",p,!1),t[0].addEventListener("tap",n,!1)),i.grid.clickable&&t.bind("click",h),i.grid.hoverable&&(t.bind("mousemove",l),t.bind("mouseleave",c))})),o.hooks.shutdown.push((function(e,t){t[0].removeEventListener("tap",n),t[0].removeEventListener("touchevent",p),t.unbind("mousemove",l),t.unbind("mouseleave",c),t.unbind("click",h),a=[]})),o.hooks.processOptions.push((function(e,t){e.highlight=g,e.unhighlight=d,(t.grid.hoverable||t.grid.clickable)&&(e.hooks.drawOverlay.push(m),e.hooks.processDatapoints.push(f),e.hooks.setupGrid.push(b)),r=e.getPlaceholder()[0].lastMouseMoveEvent}))},options:{grid:{hoverable:!1,clickable:!1}},name:"hover",version:"0.1"})}(jQuery); +!function(e){"use strict";var t=e.plot.browser,i={click:"click",hover:"hover"};e.plot.plugins.push({init:function(o){var r,a=[];function n(e){var t=o.getOptions(),r=new CustomEvent("mouseevent");return r.pageX=e.detail.changedTouches[0].pageX,r.pageY=e.detail.changedTouches[0].pageY,r.clientX=e.detail.changedTouches[0].clientX,r.clientY=e.detail.changedTouches[0].clientY,t.grid.hoverable&&s(r,i.hover,30),!1}function s(e,t,i){var r=o.getData();if(void 0!==e&&r.length>0&&void 0!==r[0].xaxis.c2p&&void 0!==r[0].yaxis.c2p){var a=t+"able";u("plot"+t,e,(function(e){return!1!==r[e][a]}),i)}}function l(e){r=e,o.getPlaceholder()[0].lastMouseMoveEvent=e,s(e,i.hover)}function c(e){r=void 0,o.getPlaceholder()[0].lastMouseMoveEvent=void 0,u("plothover",e,(function(e){return!1}))}function h(e){s(e,i.click)}function p(){o.unhighlight(),o.getPlaceholder().trigger("plothovercleanup")}function u(e,i,r,n){var s=o.getOptions(),l=o.offset(),c=t.getPageXY(i),h=c.X-l.left,p=c.Y-l.top,u=o.c2p({left:h,top:p}),v=void 0!==n?n:s.grid.mouseActiveRadius;u.pageX=c.X,u.pageY=c.Y;var f=o.findNearbyItems(h,p,r,v),b=f[0];for(let e=1;es.max||nl.max)){var h=t.points.radius+t.points.lineWidth/2;o.lineWidth=h,o.strokeStyle=c;var p=1.5*h;a=s.p2c(a),n=l.p2c(n),o.beginPath();var u=t.points.symbol;"circle"===u?o.arc(a,n,p,0,2*Math.PI,!1):"string"==typeof u&&r.drawSymbol&&r.drawSymbol[u]&&r.drawSymbol[u](o,a,n,p,!1),o.closePath(),o.stroke()}}function k(t,i,o){var r,a="string"==typeof t.highlightColor?t.highlightColor:e.color.parse(t.color).scale("a",.5).toString(),n=a,s=t.bars.barWidth[0]||t.bars.barWidth;switch(t.bars.align){case"left":r=0;break;case"right":r=-s;break;default:r=-s/2}o.lineWidth=t.bars.lineWidth,o.strokeStyle=a;var l=t.bars.fillTowards||0,c=l>t.yaxis.min?Math.min(t.yaxis.max,l):t.yaxis.min;e.plot.drawSeries.drawBar(i[0],i[1],i[2]||c,r,r+s,(function(){return n}),t.xaxis,t.yaxis,o,t.bars.horizontal,t.bars.lineWidth)}o.hooks.bindEvents.push((function(e,t){var i=e.getOptions();(i.grid.hoverable||i.grid.clickable)&&(t[0].addEventListener("touchevent",p,!1),t[0].addEventListener("tap",n,!1)),i.grid.clickable&&t.bind("click",h),i.grid.hoverable&&(t.bind("mousemove",l),t.bind("mouseleave",c))})),o.hooks.shutdown.push((function(e,t){t[0].removeEventListener("tap",n),t[0].removeEventListener("touchevent",p),t.unbind("mousemove",l),t.unbind("mouseleave",c),t.unbind("click",h),a=[]})),o.hooks.processOptions.push((function(e,t){e.highlight=d,e.unhighlight=g,(t.grid.hoverable||t.grid.clickable)&&(e.hooks.drawOverlay.push(m),e.hooks.processDatapoints.push(f),e.hooks.setupGrid.push(b)),r=e.getPlaceholder()[0].lastMouseMoveEvent}))},options:{grid:{hoverable:!1,clickable:!1}},name:"hover",version:"0.1"})}(jQuery); diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.js --- a/src/myams/resources/js/ext/flot/jquery.flot.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.js Fri Dec 11 11:45:23 2020 +0100 @@ -234,6 +234,7 @@ drawSeries: [], drawAxis: [], draw: [], + findNearbyItems: [], axisReserveSpace: [], bindEvents: [], drawOverlay: [], @@ -345,6 +346,7 @@ plot.computeRangeForDataSeries = computeRangeForDataSeries; plot.adjustSeriesDataRange = adjustSeriesDataRange; plot.findNearbyItem = findNearbyItem; + plot.findNearbyItems = findNearbyItems; plot.findNearbyInterpolationPoint = findNearbyInterpolationPoint; plot.computeValuePrecision = computeValuePrecision; plot.computeTickSize = computeTickSize; @@ -845,8 +847,6 @@ ps = s.datapoints.pointsize; points = s.datapoints.points; - var insertSteps = s.lines.show && s.lines.steps; - for (j = k = 0; j < data.length; ++j, k += ps) { p = data[j]; @@ -978,8 +978,8 @@ var eventList = eventManager[key] || []; eventList.push({"event": event, "handler": handler, "eventHolder": eventHolder, "priority": priority}); - eventList.sort((a, b) => b.priority - a.priority ); - eventList.forEach( eventData => { + eventList.sort((a, b) => b.priority - a.priority); + eventList.forEach(eventData => { eventData.eventHolder.unbind(eventData.event, eventData.handler); eventData.eventHolder.bind(eventData.event, eventData.handler); }); @@ -1761,7 +1761,7 @@ } if (axis.options.showTickLabels === 'all') { var associatedSeries = series.filter(function(s) { - return s.xaxis === axis; + return s.bars.horizontal ? s.yaxis === axis : s.xaxis === axis; }), notAllBarSeries = associatedSeries.some(function(s) { return !s.bars.show; @@ -2435,8 +2435,7 @@ if (series.bars.horizontal) { range.ymin += delta; range.ymax += delta + barWidth; - } - else { + } else { range.xmin += delta; range.xmax += delta + barWidth; } @@ -2465,7 +2464,7 @@ } var start = series.bars.horizontal ? 1 : 0; - for (var j = start; j < series.datapoints.points.length; j += pointsize) { + for (let j = start; j < series.datapoints.points.length; j += pointsize) { if (isFinite(series.datapoints.points[j]) && series.datapoints.points[j] !== null) { xValues.push(series.datapoints.points[j]); } @@ -2475,10 +2474,10 @@ return self.indexOf(value) === index; } - xValues = xValues.filter( onlyUnique ); - xValues.sort(function(a, b){return a - b}); - - for (var j = 1; j < xValues.length; j++) { + xValues = xValues.filter(onlyUnique); + xValues.sort(function(a, b) { return a - b }); + + for (let j = 1; j < xValues.length; j++) { var distance = Math.abs(xValues[j] - xValues[j - 1]); if (distance < minDistance && isFinite(distance)) { minDistance = distance; @@ -2492,55 +2491,85 @@ } } - // returns the data item the mouse is over/ the cursor is closest to, or null if none is found + function findNearbyItems(mouseX, mouseY, seriesFilter, radius, computeDistance) { + var items = findItems(mouseX, mouseY, seriesFilter, radius, computeDistance); + for (var i = 0; i < series.length; ++i) { + if (seriesFilter(i)) { + executeHooks(hooks.findNearbyItems, [mouseX, mouseY, series, i, radius, computeDistance, items]); + } + } + + return items.sort((a, b) => { + if (b.distance === undefined) { + return -1; + } else if (a.distance === undefined && b.distance !== undefined) { + return 1; + } + + return a.distance - b.distance; + }); + } + function findNearbyItem(mouseX, mouseY, seriesFilter, radius, computeDistance) { - var i, j, - item = null, + var items = findNearbyItems(mouseX, mouseY, seriesFilter, radius, computeDistance); + return items[0] !== undefined ? items[0] : null; + } + + // returns the data item the mouse is over/ the cursor is closest to, or null if none is found + function findItems(mouseX, mouseY, seriesFilter, radius, computeDistance) { + var i, foundItems = [], + items = [], smallestDistance = radius * radius + 1; - for (var i = series.length - 1; i >= 0; --i) { + for (i = series.length - 1; i >= 0; --i) { if (!seriesFilter(i)) continue; var s = series[i]; if (!s.datapoints) return; + var foundPoint = false; if (s.lines.show || s.points.show) { - var found = findNearbyPoint(s, mouseX, mouseY, radius, smallestDistance, computeDistance); + var found = findNearbyPoint(s, mouseX, mouseY, radius, computeDistance); if (found) { - smallestDistance = found.distance; - item = [i, found.dataIndex]; + items.push({ seriesIndex: i, dataIndex: found.dataIndex, distance: found.distance }); + foundPoint = true; } } - if (s.bars.show && !item) { // no other point can be nearby + if (s.bars.show && !foundPoint) { // no other point can be nearby var foundIndex = findNearbyBar(s, mouseX, mouseY); - if (foundIndex >= 0) item = [i, foundIndex]; + if (foundIndex >= 0) { + items.push({ seriesIndex: i, dataIndex: foundIndex, distance: smallestDistance }); + } } } - if (item) { - i = item[0]; - j = item[1]; - var ps = series[i].datapoints.pointsize; - - return { - datapoint: series[i].datapoints.points.slice(j * ps, (j + 1) * ps), - dataIndex: j, - series: series[i], - seriesIndex: i - }; + for (i = 0; i < items.length; i++) { + var seriesIndex = items[i].seriesIndex; + var dataIndex = items[i].dataIndex; + var itemDistance = items[i].distance; + var ps = series[seriesIndex].datapoints.pointsize; + + foundItems.push({ + datapoint: series[seriesIndex].datapoints.points.slice(dataIndex * ps, (dataIndex + 1) * ps), + dataIndex: dataIndex, + series: series[seriesIndex], + seriesIndex: seriesIndex, + distance: Math.sqrt(itemDistance) + }); } - return null; + return foundItems; } - function findNearbyPoint (series, mouseX, mouseY, maxDistance, smallestDistance, computeDistance) { + function findNearbyPoint (series, mouseX, mouseY, maxDistance, computeDistance) { var mx = series.xaxis.c2p(mouseX), my = series.yaxis.c2p(mouseY), maxx = maxDistance / series.xaxis.scale, maxy = maxDistance / series.yaxis.scale, points = series.datapoints.points, - ps = series.datapoints.pointsize; + ps = series.datapoints.pointsize, + smallestDistance = Number.POSITIVE_INFINITY; // with inverse transforms, we can't use the maxx/maxy // optimization, sadly @@ -2604,21 +2633,24 @@ barRight = barLeft + barWidth; var fillTowards = series.bars.fillTowards || 0; - var bottom = fillTowards > series.yaxis.min ? Math.min(series.yaxis.max, fillTowards) : series.yaxis.min; + var defaultBottom = fillTowards > series.yaxis.min ? Math.min(series.yaxis.max, fillTowards) : series.yaxis.min; var foundIndex = -1; for (var j = 0; j < points.length; j += ps) { var x = points[j], y = points[j + 1]; - if (x == null) + if (x == null) { continue; - + } + + var bottom = ps === 3 ? points[j + 2] : defaultBottom; // for a bar graph, the cursor must be inside the bar - if (series.bars.horizontal ? - (mx <= Math.max(bottom, x) && mx >= Math.min(bottom, x) && - my >= y + barLeft && my <= y + barRight) : - (mx >= x + barLeft && mx <= x + barRight && - my >= Math.min(bottom, y) && my <= Math.max(bottom, y))) - foundIndex = j / ps; + if (series.bars.horizontal + ? (mx <= Math.max(bottom, x) && mx >= Math.min(bottom, x) && + my >= y + barLeft && my <= y + barRight) + : (mx >= x + barLeft && mx <= x + barRight && + my >= Math.min(bottom, y) && my <= Math.max(bottom, y))) { + foundIndex = j / ps; + } } return foundIndex; diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.legend.js --- a/src/myams/resources/js/ext/flot/jquery.flot.legend.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.legend.js Fri Dec 11 11:45:23 2020 +0100 @@ -52,7 +52,7 @@ var columnWidths = []; var style = window.getComputedStyle(document.querySelector('body')); for (i = 0; i < entries.length; ++i) { - var columnIndex = i % options.legend.noColumns; + let columnIndex = i % options.legend.noColumns; entry = entries[i]; shape.label = entry.label; var info = plot.getSurface().getTextInfo('', shape.label, { @@ -78,7 +78,7 @@ // Generate html for icons and labels from a list of entries for (i = 0; i < entries.length; ++i) { - var columnIndex = i % options.legend.noColumns; + let columnIndex = i % options.legend.noColumns; entry = entries[i]; iconHtml = ''; shape.label = entry.label; @@ -95,26 +95,32 @@ iconHtml += getEntryIconHtml(shape); } // bars - if (entry.options.bars.show) { + else if (entry.options.bars.show) { shape.name = 'bar'; shape.fillColor = entry.color; iconHtml += getEntryIconHtml(shape); } // lines - if (entry.options.lines.show && !entry.options.lines.fill) { + else if (entry.options.lines.show && !entry.options.lines.fill) { shape.name = 'line'; shape.strokeColor = entry.color; shape.strokeWidth = entry.options.lines.lineWidth; iconHtml += getEntryIconHtml(shape); } // points - if (entry.options.points.show) { + else if (entry.options.points.show) { shape.name = entry.options.points.symbol; shape.strokeColor = entry.color; shape.fillColor = entry.options.points.fillColor; shape.strokeWidth = entry.options.points.lineWidth; iconHtml += getEntryIconHtml(shape); } + // default + else { + shape.name = 'pie'; + shape.fillColor = entry.color; + iconHtml += getEntryIconHtml(shape); + } labelHtml = '' + shape.label + '' html[j++] = '' + iconHtml + labelHtml + ''; @@ -176,6 +182,16 @@ 'width="1.5em" height="1.5em"' + '/>'; break; + case 'pie': + html = ''; + break; case 'diamond': html = '' + '' + + '' + + '' + + '' + + '' + '' + '' + diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.legend.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.legend.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.legend.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -!function(e){function t(e){var t="",o=e.name,l=e.xPos,n=e.yPos,i=e.fillColor,s=e.strokeColor,r=e.strokeWidth;switch(o){case"circle":t='';break;case"diamond":t='';break;case"cross":t='';break;case"rectangle":t='';break;case"plus":t='';break;case"bar":t='';break;case"area":t='';break;case"line":t='';break;default:t=''}return t}var o='';function l(e,t){for(var o in e)if(e.hasOwnProperty(o)&&e[o]!==t[o])return!0;return!1}e.plot.plugins.push({init:function(n){n.hooks.setupGrid.push((function(n){var i=n.getOptions(),s=n.getData(),r=i.legend.labelFormatter,a=i.legend.legendEntries,h=i.legend.plotOffset,d=function(t,o,l){var n=o,i=t.reduce((function(e,t,o){var l=n?n(t.label,t):t.label;if(!t.hasOwnProperty("label")||l){var i={label:l||"Plot "+(o+1),color:t.color,options:{lines:t.lines,points:t.points,bars:t.bars}};e.push(i)}return e}),[]);if(l)if(e.isFunction(l))i.sort(l);else if("reverse"===l)i.reverse();else{var s="descending"!==l;i.sort((function(e,t){return e.label===t.label?0:e.label',p[f++]='',p[f++]=o;var x=0,w=[],k=window.getComputedStyle(document.querySelector("body"));for(d=0;dw[v]&&(w[v]=L+48):w[v]=L+48}for(d=0;d'+y.label+"",p[f++]=""+h+a+""}p[f++]="",null==b[0]&&(b=[b,b]),"n"===u.charAt(0)?m+="top:"+(b[1]+g.top)+"px;":"s"===u.charAt(0)&&(m+="bottom:"+(b[1]+g.bottom)+"px;"),"e"===u.charAt(1)?m+="right:"+(b[0]+g.right)+"px;":"w"===u.charAt(1)&&(m+="left:"+(b[0]+g.left)+"px;");var M=6;for(d=0;d'+p.join("")+"").appendTo(i)).css("width",M+"px"),C.css("height",P+"em"),C.css("pointerEvents","none"))}}(n,i,n.getPlaceholder(),d)}))},options:{legend:{show:!1,noColumns:1,labelFormatter:null,container:null,position:"ne",margin:5,sorted:null}},name:"legend",version:"1.0"})}(jQuery); +!function(e){function l(e){var l="",t=e.name,o=e.xPos,n=e.yPos,i=e.fillColor,s=e.strokeColor,r=e.strokeWidth;switch(t){case"circle":l='';break;case"pie":l='';break;case"diamond":l='';break;case"cross":l='';break;case"rectangle":l='';break;case"plus":l='';break;case"bar":l='';break;case"area":l='';break;case"line":l='';break;default:l=''}return l}var t='';function o(e,l){for(var t in e)if(e.hasOwnProperty(t)&&e[t]!==l[t])return!0;return!1}e.plot.plugins.push({init:function(n){n.hooks.setupGrid.push((function(n){var i=n.getOptions(),s=n.getData(),r=i.legend.labelFormatter,a=i.legend.legendEntries,h=i.legend.plotOffset,d=function(l,t,o){var n=t,i=l.reduce((function(e,l,t){var o=n?n(l.label,l):l.label;if(!l.hasOwnProperty("label")||o){var i={label:o||"Plot "+(t+1),color:l.color,options:{lines:l.lines,points:l.points,bars:l.bars}};e.push(i)}return e}),[]);if(o)if(e.isFunction(o))i.sort(o);else if("reverse"===o)i.reverse();else{var s="descending"!==o;i.sort((function(e,l){return e.label===l.label?0:e.label',p[f++]='',p[f++]=t;var x=0,w=[],k=window.getComputedStyle(document.querySelector("body"));for(d=0;dw[e]&&(w[e]=v+48):w[e]=v+48}for(d=0;d'+b.label+"",p[f++]=""+h+a+""}p[f++]="",null==y[0]&&(y=[y,y]),"n"===u.charAt(0)?m+="top:"+(y[1]+g.top)+"px;":"s"===u.charAt(0)&&(m+="bottom:"+(y[1]+g.bottom)+"px;"),"e"===u.charAt(1)?m+="right:"+(y[0]+g.right)+"px;":"w"===u.charAt(1)&&(m+="left:"+(y[0]+g.left)+"px;");var L=6;for(d=0;d'+p.join("")+"").appendTo(i)).css("width",L+"px"),M.css("height",C+"em"),M.css("pointerEvents","none"))}}(n,i,n.getPlaceholder(),d)}))},options:{legend:{show:!1,noColumns:1,labelFormatter:null,container:null,position:"ne",margin:5,sorted:null}},name:"legend",version:"1.0"})}(jQuery); diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.logaxis.js --- a/src/myams/resources/js/ext/flot/jquery.flot.logaxis.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.logaxis.js Fri Dec 11 11:45:23 2020 +0100 @@ -249,9 +249,9 @@ .map(function(series) { return plot.computeRangeForDataSeries(series, null, isValid); }), - min = axis.direction === 'x' - ? Math.min(0.1, range && range[0] ? range[0].xmin : 0.1) - : Math.min(0.1, range && range[0] ? range[0].ymin : 0.1); + min = axis.direction === 'x' + ? Math.min(0.1, range && range[0] ? range[0].xmin : 0.1) + : Math.min(0.1, range && range[0] ? range[0].ymin : 0.1); axis.min = min; diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -!function(t){"use strict";var i=window.Flot.Canvas;function o(i){var o,n=[],e=t.plot.saturated.saturate(t.plot.saturated.floorInBase(i.min,i.tickSize)),a=0,r=Number.NaN;e===-Number.MAX_VALUE&&(n.push(e),e=t.plot.saturated.floorInBase(i.min+i.tickSize,i.tickSize));do{o=r,r=t.plot.saturated.multiplyAdd(i.tickSize,a,e),n.push(r),++a}while(r0&&(i.tickDecimals=o);var a=i.tickDecimals?parseFloat("1e"+i.tickDecimals):1,r=""+Math.round(t*a)/a;if(null!=i.tickDecimals){var l=r.indexOf("."),s=-1===l?0:r.length-l-1;if(s0?Math.floor(Math.log(t)/Math.LN10):0,l=parseFloat("1e"+r),s=t/l;if(o){var c=a(t,o);return(t/l).toFixed(c)+"e"+r}return i.tickDecimals>0?s.toFixed(a(t,i.tickDecimals))+"e"+r:s.toFixed()+"e"+r}function a(t,i){var o=Math.log(Math.abs(t))*Math.LOG10E,n=Math.abs(o+i);return n<=20?Math.floor(n):20}function r(e,a,r,l){var s=[],c={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],xaxis:{show:null,position:"bottom",mode:null,font:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoScaleMargin:null,autoScale:"exact",windowSize:null,growOnly:null,ticks:null,tickFormatter:null,showTickLabels:"major",labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,showMinorTicks:null,showTicks:null,gridLines:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null,offset:{below:0,above:0},boxPosition:{centerX:0,centerY:0}},yaxis:{autoScaleMargin:.02,autoScale:"loose",growOnly:null,position:"left",showTickLabels:"major",offset:{below:0,above:0},boxPosition:{centerX:0,centerY:0}},xaxes:[],yaxes:[],series:{points:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:1,fill:!1,fillColor:null,steps:!1},bars:{show:!1,lineWidth:2,horizontal:!1,barWidth:.8,fill:!0,fillColor:null,align:"left",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:1,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:!1,hoverable:!1,autoHighlight:!0,mouseActiveRadius:15},interaction:{redrawOverlayInterval:1e3/60},hooks:{}},u=null,f=null,h=null,d=null,p=null,m=[],x=[],g={left:0,right:0,top:0,bottom:0},b=0,v=0,k={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],setupGrid:[],adjustSeriesDataRange:[],setRange:[],drawBackground:[],drawSeries:[],drawAxis:[],draw:[],axisReserveSpace:[],bindEvents:[],drawOverlay:[],resize:[],shutdown:[]},y=this,w={},M=null;y.setData=W,y.setupGrid=P,y.draw=G,y.getPlaceholder=function(){return e},y.getCanvas=function(){return u.element},y.getSurface=function(){return u},y.getEventHolder=function(){return h[0]},y.getPlotOffset=function(){return g},y.width=function(){return b},y.height=function(){return v},y.offset=function(){var t=h.offset();return t.left+=g.left,t.top+=g.top,t},y.getData=function(){return s},y.getAxes=function(){var i={};return t.each(m.concat(x),(function(t,o){o&&(i[o.direction+(1!==o.n?o.n:"")+"axis"]=o)})),i},y.getXAxes=function(){return m},y.getYAxes=function(){return x},y.c2p=function(t){var i,o,n={};for(i=0;is.xmax&&(s.xmax=f)),!0===h.y&&(fs.ymax&&(s.ymax=f))))}return s},y.adjustSeriesDataRange=function(t,i){if(t.bars.show){var o,n=t.bars.barWidth[1];t.datapoints&&t.datapoints.points&&!n&&function(t){var i=[],o=t.datapoints.pointsize,n=Number.MAX_VALUE;t.datapoints.points.length<=o&&(n=1);for(var e=t.bars.horizontal?1:0;e=0;--c)if(o(c)){var u=s[c];if(!u.datapoints)return;if(u.lines.show||u.points.show){var f=Q(u,t,i,n,l,e);f&&(l=f.distance,r=[c,f.dataIndex])}if(u.bars.show&&!r){var h=$(u,t,i);h>=0&&(r=[c,h])}}if(r){c=r[0],a=r[1];var d=s[c].datapoints.pointsize;return{datapoint:s[c].datapoints.points.slice(a*d,(a+1)*d),dataIndex:a,series:s[c],seriesIndex:c}}return null},y.findNearbyInterpolationPoint=function(t,i,o){var n,e,a,r,l,c,u,f=Number.MAX_VALUE;for(n=0;ni}:function(t,i){return i>t};if(!g(t,h[0])){for(e=c;ei.priority-t.priority),a.forEach(t=>{t.eventHolder.unbind(t.event,t.handler),t.eventHolder.bind(t.event,t.handler)}),w[e]=a},y.hooks=k;var S=t.plot.uiConstants.MINOR_TICKS_COUNT_CONSTANT,T=t.plot.uiConstants.TICK_LENGTH_CONSTANT;function N(t,i){i=[y].concat(i);for(var o=0;on&&(n=e))}o<=n&&(o=n+1);var a,r=[],l=c.colors,u=l.length,f=0,h=Math.max(0,s.length-o);for(i=0;i=0?f<.5?-f-.2:0:-f),r[i]=a.scale("rgb",1+f);var d,p=0;for(i=0;it.datamax&&o!==1/0&&(t.datamax=o)}function b(t,i){return t&&t[i]&&t[i].datapoints&&t[i].datapoints.points?t[i].datapoints.points:[]}for(t.each(z(),(function(t,i){!0!==i.options.growOnly?(i.datamin=m,i.datamax=x):(void 0===i.datamin&&(i.datamin=m),void 0===i.datamax&&(i.datamax=x)),i.used=!1})),o=0;o2&&p.push({x:!1,y:!0,number:!0,required:!1,computeRange:"none"!==r.yaxis.options.autoScale,defaultValue:0});r.datapoints.format=p}if(r.xaxis.used=r.yaxis.used=!0,null==r.datapoints.pointsize){r.datapoints.pointsize=p.length,c=r.datapoints.pointsize,l=r.datapoints.points;r.lines.show&&r.lines.steps;for(n=e=0;ne){var r=n;n=e,e=r,i.options.offset={above:0,below:0}}i.min=t.plot.saturated.saturate(n),i.max=t.plot.saturated.saturate(e)}(e,i)})),l){b=u.width-g.left-g.right,v=u.height-g.bottom-g.top;var f=t.grep(r,(function(t){return t.show||t.reserveSpace}));for(t.each(f,(function(i,n){!function(i){var n,e=i.options;n=E(i.direction,u,e.ticks),i.delta=t.plot.saturated.delta(i.min,i.max,n);var a=y.computeValuePrecision(i.min,i.max,i.direction,n,e.tickDecimals);i.tickDecimals=Math.max(0,null!=e.tickDecimals?e.tickDecimals:a),i.tickSize=function(t,i,o,n,e){var a;a="number"==typeof n.ticks&&n.ticks>0?n.ticks:.3*Math.sqrt("x"===o?u.width:u.height);var r=j(t,i,a,e);null!=n.minTickSize&&r0&&(null==e.min&&(i.min=Math.min(i.min,l[0])),null==e.max&&l.length>1&&(i.max=Math.max(i.max,l[l.length-1]))),i.tickGenerator=function(t){var i,o,n=[];for(o=0;o1&&/\..*0$/.test((c[1]-c[0]).toFixed(s))||(i.tickDecimals=s)}}}}(n),function(i){var o,n,e=i.options.ticks,a=[];null==e||"number"==typeof e&&e>0?a=i.tickGenerator(i,y):e&&(a=t.isFunction(e)?e(i):e);for(i.ticks=[],o=0;o1&&(r=l[1])):n=+l,isNaN(n)||i.ticks.push(H(n,r,i,"major"))}}(n),function(t,i,o){"loose"===t.options.autoScale&&i.length>0&&function(t){return t.some(t=>t.datapoints.points.length>0)}(o)&&(t.min=Math.min(t.min,i[0].v),t.max=Math.max(t.max,i[i.length-1].v))}(n,n.ticks,s),D(n),function(t,i){(function(t,i){if("endpoints"===t.options.showTickLabels)return!0;if("all"===t.options.showTickLabels){var o=i.filter((function(i){return i.xaxis===t})),n=o.some((function(t){return!t.bars.show}));return 0===o.length||n}if("major"===t.options.showTickLabels||"none"===t.options.showTickLabels)return!1})(t,i)&&(t.ticks.unshift(H(t.min,null,t,"min")),t.ticks.push(H(t.max,null,t,"max")))}(n,s),function(t){for(var i=t.options,o="none"!==i.showTickLabels&&t.ticks?t.ticks:[],n="major"===i.showTickLabels||"all"===i.showTickLabels,e="endpoints"===i.showTickLabels||"all"===i.showTickLabels,a=i.labelWidth||0,r=i.labelHeight||0,l=t.direction+"Axis "+t.direction+t.n+"Axis",s="flot-"+t.direction+"-axis flot-"+t.direction+t.n+"-axis "+l,c=i.font||"flot-tick-label tickLabel",f=0;f0&&f=0;--e)F(f[e]);!function(){var i,o=c.grid.minBorderMargin;if(null==o)for(o=0,i=0;i0}))})),g.left=Math.ceil(Math.max(a.left,g.left)),g.right=Math.ceil(Math.max(a.right,g.right)),g.top=Math.ceil(Math.max(a.top,g.top)),g.bottom=Math.ceil(Math.max(a.bottom,g.bottom))}(),t.each(f,(function(t,i){!function(t){"x"===t.direction?(t.box.left=g.left-t.labelWidth/2,t.box.width=u.width-g.left-g.right+t.labelWidth):(t.box.top=g.top-t.labelHeight/2,t.box.height=u.height-g.bottom-g.top+t.labelHeight)}(i)}))}if(c.grid.margin){for(a in g){var h=c.grid.margin||0;g[a]+="number"==typeof h?h:h[a]||0}t.each(m.concat(x),(function(t,i){A(i,c.grid.margin,(function(t){return null!=t}))}))}b=u.width-g.left-g.right,v=u.height-g.bottom-g.top,t.each(r,(function(t,i){D(i)})),l&&t.each(z(),(function(t,i){var o,n,e,a,r,l,s,c=i.box,f=i.direction+"Axis "+i.direction+i.n+"Axis",h="flot-"+i.direction+"-axis flot-"+i.direction+i.n+"-axis "+f,d=i.options.font||"flot-tick-label tickLabel",p={x:NaN,y:NaN,width:NaN,height:NaN},m=[],x=function(t,o){return!t||!t.label||t.vi.max?p:(l=u.getTextInfo(h,t.label,d),"x"===i.direction?(a="center",n=g.left+i.p2c(t.v),"bottom"===i.position?e=c.top+c.padding-i.boxPosition.centerY:(e=c.top+c.height-c.padding+i.boxPosition.centerY,r="bottom"),s={x:n-l.width/2-3,y:e-3,width:l.width+6,height:l.height+6}):(r="middle",e=g.top+i.p2c(t.v),"left"===i.position?(n=c.left+c.width-c.padding-i.boxPosition.centerX,a="right"):n=c.left+c.padding+i.boxPosition.centerX,s={x:n-l.width/2-3,y:e-3,width:l.width+6,height:l.height+6}),function(t,i){return i.some((function(i){return o=t.x,n=t.y,e=t.x+t.width,a=t.y+t.height,r=i.x,l=i.y,s=i.x+i.width,c=i.y+i.height,(o<=r&&r<=e||r<=o&&o<=s)&&(n<=l&&l<=a||l<=n&&n<=c);var o,n,e,a,r,l,s,c}))}(s,o)?p:(u.addText(h,n,e,t.label,d,null,null,a,r),s))};if(u.removeText(h),N(k.drawAxis,[i,u]),i.show)switch(i.options.showTickLabels){case"none":break;case"endpoints":m.push(x(i.ticks[0],m)),m.push(x(i.ticks[i.ticks.length-1],m));break;case"major":for(m.push(x(i.ticks[0],m)),m.push(x(i.ticks[i.ticks.length-1],m)),o=1;o=0&&(e=0)}else e=n.min,a=n.max;break;case"exact":e=null!=r?r:n.min,a=null!=l?l:n.max;break;case"sliding-window":l>a&&(a=l,e=Math.max(l-(n.windowSize||100),e))}var c=function(t,i){var o=void 0===t?null:t,n=void 0===i?null:i;if(0===n-o){var e=0===n?1:.01,a=null;null==o&&(a-=e),null!=n&&null==o||(n+=e),null!=a&&(o=a)}return{min:o,max:n}}(e,a);e=c.min,a=c.max,!0===n.growOnly&&"none"!==n.autoScale&&"sliding-window"!==n.autoScale&&(e=el?a:null!==l?l:a),i.autoScaledMin=e,i.autoScaledMax=a}function R(i,o,n,e,a){var r=E(n,u,e),l=t.plot.saturated.delta(i,o,r),s=-Math.floor(Math.log(l)/Math.LN10);a&&s>a&&(s=a);var c=l/parseFloat("1e"+-s);return c>2.25&&c<3&&s+1<=a&&++s,isFinite(s)?s:0}function j(i,o,n,e){var a=t.plot.saturated.delta(i,o,n),r=-Math.floor(Math.log(a)/Math.LN10);e&&r>e&&(r=e);var l,s=parseFloat("1e"+-r),c=a/s;return c<1.5?l=1:c<3?(l=2,c>2.25&&(null==e||r+1<=e)&&(l=2.5)):l=c<7.5?5:10,l*=s}function E(t,i,o){return"number"==typeof o&&o>0?o:.3*Math.sqrt("x"===t?i.width:i.height)}function H(t,i,o,n){if(null===i)switch(n){case"min":case"max":var e=function(t,i){var o=Math.floor(i.p2c(t)),n="x"===i.direction?o+1:o-1,e=i.c2p(o),a=i.c2p(n);return R(e,a,i.direction,1)}(t,o);isFinite(e),i=o.tickFormatter(t,o,e,y);break;case"major":i=o.tickFormatter(t,o,void 0,y)}return{v:t,label:i}}function G(){u.clear(),N(k.drawBackground,[d]);var t=c.grid;t.show&&t.backgroundColor&&(d.save(),d.translate(g.left,g.top),d.fillStyle=tt(c.grid.backgroundColor,v,0,"rgba(255, 255, 255, 0)"),d.fillRect(0,0,b,v),d.restore()),t.show&&!t.aboveData&&U();for(var i=0;ie){var s=n;n=e,e=s}return{from:n,to:e,axis:o}}function _(t){var i=t.box,o=0,n=0;return"x"===t.direction?(o=0,n=i.top-g.top+("top"===t.position?i.height:0)):(n=0,o=i.left-g.left+("left"===t.position?i.width:0)+t.boxPosition.centerX),{x:o,y:n}}function X(t,i){return t%2!=0?Math.floor(i)+.5:i}function Y(t){d.lineWidth=1;var i=_(t),o=i.x,n=i.y;if(t.show){var e=0,a=0;d.strokeStyle=t.options.color,d.beginPath(),"x"===t.direction?e=b+1:a=v+1,"x"===t.direction?n=X(d.lineWidth,n):o=X(d.lineWidth,o),d.moveTo(o,n),d.lineTo(o+e,n+a),d.stroke()}}function B(t){var i=t.tickLength,o=t.showMinorTicks,n=S,e=_(t),a=e.x,r=e.y,l=0;for(d.strokeStyle=t.options.color,d.beginPath(),l=0;l=t.min&&c<=t.max&&("x"===t.direction?(a=t.p2c(c),f=i,"top"===t.position&&(f=-f)):(r=t.p2c(c),u=i,"left"===t.position&&(u=-u)),"x"===t.direction?a=X(d.lineWidth,a):r=X(d.lineWidth,r),d.moveTo(a,r),d.lineTo(a+u,r+f)),!0===o&&lb)continue}else if(h=i/2,r=X(d.lineWidth,t.p2c(m+s*x)),"left"===t.position&&(h=-h),r<0||r>v)continue;d.moveTo(a,r),d.lineTo(a+h,r+p)}}}d.stroke()}function q(t){var i,o,n;for(d.strokeStyle=c.grid.tickColor,d.beginPath(),i=0;it.max||(o=e,n=void 0,(!("object"==typeof(n=c.grid.borderWidth)&&n[t.position]>0||n>0)||o!==t.min&&o!==t.max)&&("x"===t.direction?(l=t.p2c(e),s=v,r=-v):(l=0,s=t.p2c(e),a=b),"x"===t.direction?l=X(d.lineWidth,l):s=X(d.lineWidth,s),d.moveTo(l,s),d.lineTo(l+a,s+r)))}d.stroke()}function U(){var i,o;d.save(),d.translate(g.left,g.top),function(){var i,o,n=c.grid.markings;if(n)for(t.isFunction(n)&&((i=y.getAxes()).xmin=i.xaxis.min,i.xmax=i.xaxis.max,i.ymin=i.yaxis.min,i.ymax=i.yaxis.max,n=n(i)),o=0;oa.axis.max||r.tor.axis.max)){a.from=Math.max(a.from,a.axis.min),a.to=Math.min(a.to,a.axis.max),r.from=Math.max(r.from,r.axis.min),r.to=Math.min(r.to,r.axis.max);var l=a.from===a.to,s=r.from===r.to;if(!l||!s)if(a.from=Math.floor(a.axis.p2c(a.from)),a.to=Math.floor(a.axis.p2c(a.to)),r.from=Math.floor(r.axis.p2c(r.from)),r.to=Math.floor(r.axis.p2c(r.to)),l||s){var u=e.lineWidth||c.grid.markingsLineWidth,f=u%2?.5:0;d.beginPath(),d.strokeStyle=e.color||c.grid.markingsColor,d.lineWidth=u,l?(d.moveTo(a.to+f,r.from),d.lineTo(a.to+f,r.to)):(d.moveTo(a.from,r.to+f),d.lineTo(a.to,r.to+f)),d.stroke()}else d.fillStyle=e.color||c.grid.markingsColor,d.fillRect(a.from,r.to,a.to-a.from,r.from-r.to)}}}(),i=z(),o=c.grid.borderWidth;for(var n=0;n0&&(d.strokeStyle=i.top,d.lineWidth=t.top,d.beginPath(),d.moveTo(0-t.left,0-t.top/2),d.lineTo(b,0-t.top/2),d.stroke()),t.right>0&&(d.strokeStyle=i.right,d.lineWidth=t.right,d.beginPath(),d.moveTo(b+t.right/2,0-t.top),d.lineTo(b+t.right/2,v),d.stroke()),t.bottom>0&&(d.strokeStyle=i.bottom,d.lineWidth=t.bottom,d.beginPath(),d.moveTo(b+t.right,v+t.bottom/2),d.lineTo(0,v+t.bottom/2),d.stroke()),t.left>0&&(d.strokeStyle=i.left,d.lineWidth=t.left,d.beginPath(),d.moveTo(0-t.left/2,v+t.bottom),d.lineTo(0-t.left/2,0),d.stroke())):(d.lineWidth=t,d.strokeStyle=c.grid.borderColor,d.strokeRect(-t/2,-t/2,b+t,v+t))}(),d.restore()}function K(i){i.lines.show&&t.plot.drawSeries.drawSeriesLines(i,d,g,b,v,y.drawSymbol,tt),i.bars.show&&t.plot.drawSeries.drawSeriesBars(i,d,g,b,v,y.drawSymbol,tt),i.points.show&&t.plot.drawSeries.drawSeriesPoints(i,d,g,b,v,y.drawSymbol,tt)}function Q(t,i,o,n,e,a){var r=t.xaxis.c2p(i),l=t.yaxis.c2p(o),s=n/t.xaxis.scale,c=n/t.yaxis.scale,u=t.datapoints.points,f=t.datapoints.pointsize;t.xaxis.options.inverseTransform&&(s=Number.MAX_VALUE),t.yaxis.options.inverseTransform&&(c=Number.MAX_VALUE);for(var h=null,d=0;ds||p-r<-s||m-l>c||m-l<-c)){var x=Math.abs(t.xaxis.p2c(p)-i),g=Math.abs(t.yaxis.p2c(m)-o),b=a?a(x,g):x*x+g*g;bt.yaxis.min?Math.min(t.yaxis.max,u):t.yaxis.min,h=-1,d=0;d=Math.min(f,p)&&l>=m+n&&l<=m+e:r>=p+n&&r<=p+e&&l>=Math.min(f,m)&&l<=Math.max(f,m))&&(h=d/c))}return h}function J(){var t=c.interaction.redrawOverlayInterval;-1!==t?M||(M=setTimeout((function(){Z(y)}),t)):Z()}function Z(t){if(M=null,p){f.clear(),N(k.drawOverlay,[p,f]);var i=new CustomEvent("onDrawingDone");t.getEventHolder().dispatchEvent(i),t.getPlaceholder().trigger("drawingdone")}}function tt(i,o,n,e){if("string"==typeof i)return i;for(var a=d.createLinearGradient(0,n,0,o),r=0,l=i.colors.length;r0&&(i.tickDecimals=o);var a=i.tickDecimals?parseFloat("1e"+i.tickDecimals):1,r=""+Math.round(t*a)/a;if(null!=i.tickDecimals){var l=r.indexOf("."),s=-1===l?0:r.length-l-1;if(s0?Math.floor(Math.log(t)/Math.LN10):0,l=parseFloat("1e"+r),s=t/l;if(o){var c=a(t,o);return(t/l).toFixed(c)+"e"+r}return i.tickDecimals>0?s.toFixed(a(t,i.tickDecimals))+"e"+r:s.toFixed()+"e"+r}function a(t,i){var o=Math.log(Math.abs(t))*Math.LOG10E,n=Math.abs(o+i);return n<=20?Math.floor(n):20}function r(e,a,r,l){var s=[],c={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],xaxis:{show:null,position:"bottom",mode:null,font:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoScaleMargin:null,autoScale:"exact",windowSize:null,growOnly:null,ticks:null,tickFormatter:null,showTickLabels:"major",labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,showMinorTicks:null,showTicks:null,gridLines:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null,offset:{below:0,above:0},boxPosition:{centerX:0,centerY:0}},yaxis:{autoScaleMargin:.02,autoScale:"loose",growOnly:null,position:"left",showTickLabels:"major",offset:{below:0,above:0},boxPosition:{centerX:0,centerY:0}},xaxes:[],yaxes:[],series:{points:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:1,fill:!1,fillColor:null,steps:!1},bars:{show:!1,lineWidth:2,horizontal:!1,barWidth:.8,fill:!0,fillColor:null,align:"left",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:1,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:!1,hoverable:!1,autoHighlight:!0,mouseActiveRadius:15},interaction:{redrawOverlayInterval:1e3/60},hooks:{}},u=null,f=null,h=null,d=null,p=null,m=[],x=[],g={left:0,right:0,top:0,bottom:0},b=0,v=0,k={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],setupGrid:[],adjustSeriesDataRange:[],setRange:[],drawBackground:[],drawSeries:[],drawAxis:[],draw:[],findNearbyItems:[],axisReserveSpace:[],bindEvents:[],drawOverlay:[],resize:[],shutdown:[]},y=this,w={},M=null;y.setData=W,y.setupGrid=P,y.draw=G,y.getPlaceholder=function(){return e},y.getCanvas=function(){return u.element},y.getSurface=function(){return u},y.getEventHolder=function(){return h[0]},y.getPlotOffset=function(){return g},y.width=function(){return b},y.height=function(){return v},y.offset=function(){var t=h.offset();return t.left+=g.left,t.top+=g.top,t},y.getData=function(){return s},y.getAxes=function(){var i={};return t.each(m.concat(x),(function(t,o){o&&(i[o.direction+(1!==o.n?o.n:"")+"axis"]=o)})),i},y.getXAxes=function(){return m},y.getYAxes=function(){return x},y.c2p=function(t){var i,o,n={};for(i=0;is.xmax&&(s.xmax=f)),!0===h.y&&(fs.ymax&&(s.ymax=f))))}return s},y.adjustSeriesDataRange=function(t,i){if(t.bars.show){var o,n=t.bars.barWidth[1];t.datapoints&&t.datapoints.points&&!n&&function(t){var i=[],o=t.datapoints.pointsize,n=Number.MAX_VALUE;t.datapoints.points.length<=o&&(n=1);for(let n=t.bars.horizontal?1:0;ni}:function(t,i){return i>t};if(!g(t,h[0])){for(e=c;ei.priority-t.priority),a.forEach(t=>{t.eventHolder.unbind(t.event,t.handler),t.eventHolder.bind(t.event,t.handler)}),w[e]=a},y.hooks=k;var S=t.plot.uiConstants.MINOR_TICKS_COUNT_CONSTANT,T=t.plot.uiConstants.TICK_LENGTH_CONSTANT;function N(t,i){i=[y].concat(i);for(var o=0;on&&(n=e))}o<=n&&(o=n+1);var a,r=[],l=c.colors,u=l.length,f=0,h=Math.max(0,s.length-o);for(i=0;i=0?f<.5?-f-.2:0:-f),r[i]=a.scale("rgb",1+f);var d,p=0;for(i=0;it.datamax&&o!==1/0&&(t.datamax=o)}function b(t,i){return t&&t[i]&&t[i].datapoints&&t[i].datapoints.points?t[i].datapoints.points:[]}for(t.each(z(),(function(t,i){!0!==i.options.growOnly?(i.datamin=m,i.datamax=x):(void 0===i.datamin&&(i.datamin=m),void 0===i.datamax&&(i.datamax=x)),i.used=!1})),o=0;o2&&p.push({x:!1,y:!0,number:!0,required:!1,computeRange:"none"!==r.yaxis.options.autoScale,defaultValue:0});r.datapoints.format=p}if(r.xaxis.used=r.yaxis.used=!0,null==r.datapoints.pointsize){for(r.datapoints.pointsize=p.length,c=r.datapoints.pointsize,l=r.datapoints.points,n=e=0;ne){var r=n;n=e,e=r,i.options.offset={above:0,below:0}}i.min=t.plot.saturated.saturate(n),i.max=t.plot.saturated.saturate(e)}(e,i)})),l){b=u.width-g.left-g.right,v=u.height-g.bottom-g.top;var f=t.grep(r,(function(t){return t.show||t.reserveSpace}));for(t.each(f,(function(i,n){!function(i){var n,e=i.options;n=j(i.direction,u,e.ticks),i.delta=t.plot.saturated.delta(i.min,i.max,n);var a=y.computeValuePrecision(i.min,i.max,i.direction,n,e.tickDecimals);i.tickDecimals=Math.max(0,null!=e.tickDecimals?e.tickDecimals:a),i.tickSize=function(t,i,o,n,e){var a;a="number"==typeof n.ticks&&n.ticks>0?n.ticks:.3*Math.sqrt("x"===o?u.width:u.height);var r=E(t,i,a,e);null!=n.minTickSize&&r0&&(null==e.min&&(i.min=Math.min(i.min,l[0])),null==e.max&&l.length>1&&(i.max=Math.max(i.max,l[l.length-1]))),i.tickGenerator=function(t){var i,o,n=[];for(o=0;o1&&/\..*0$/.test((c[1]-c[0]).toFixed(s))||(i.tickDecimals=s)}}}}(n),function(i){var o,n,e=i.options.ticks,a=[];null==e||"number"==typeof e&&e>0?a=i.tickGenerator(i,y):e&&(a=t.isFunction(e)?e(i):e);for(i.ticks=[],o=0;o1&&(r=l[1])):n=+l,isNaN(n)||i.ticks.push(H(n,r,i,"major"))}}(n),function(t,i,o){"loose"===t.options.autoScale&&i.length>0&&function(t){return t.some(t=>t.datapoints.points.length>0)}(o)&&(t.min=Math.min(t.min,i[0].v),t.max=Math.max(t.max,i[i.length-1].v))}(n,n.ticks,s),D(n),function(t,i){(function(t,i){if("endpoints"===t.options.showTickLabels)return!0;if("all"===t.options.showTickLabels){var o=i.filter((function(i){return i.bars.horizontal?i.yaxis===t:i.xaxis===t})),n=o.some((function(t){return!t.bars.show}));return 0===o.length||n}if("major"===t.options.showTickLabels||"none"===t.options.showTickLabels)return!1})(t,i)&&(t.ticks.unshift(H(t.min,null,t,"min")),t.ticks.push(H(t.max,null,t,"max")))}(n,s),function(t){for(var i=t.options,o="none"!==i.showTickLabels&&t.ticks?t.ticks:[],n="major"===i.showTickLabels||"all"===i.showTickLabels,e="endpoints"===i.showTickLabels||"all"===i.showTickLabels,a=i.labelWidth||0,r=i.labelHeight||0,l=t.direction+"Axis "+t.direction+t.n+"Axis",s="flot-"+t.direction+"-axis flot-"+t.direction+t.n+"-axis "+l,c=i.font||"flot-tick-label tickLabel",f=0;f0&&f=0;--e)F(f[e]);!function(){var i,o=c.grid.minBorderMargin;if(null==o)for(o=0,i=0;i0}))})),g.left=Math.ceil(Math.max(a.left,g.left)),g.right=Math.ceil(Math.max(a.right,g.right)),g.top=Math.ceil(Math.max(a.top,g.top)),g.bottom=Math.ceil(Math.max(a.bottom,g.bottom))}(),t.each(f,(function(t,i){!function(t){"x"===t.direction?(t.box.left=g.left-t.labelWidth/2,t.box.width=u.width-g.left-g.right+t.labelWidth):(t.box.top=g.top-t.labelHeight/2,t.box.height=u.height-g.bottom-g.top+t.labelHeight)}(i)}))}if(c.grid.margin){for(a in g){var h=c.grid.margin||0;g[a]+="number"==typeof h?h:h[a]||0}t.each(m.concat(x),(function(t,i){A(i,c.grid.margin,(function(t){return null!=t}))}))}b=u.width-g.left-g.right,v=u.height-g.bottom-g.top,t.each(r,(function(t,i){D(i)})),l&&t.each(z(),(function(t,i){var o,n,e,a,r,l,s,c=i.box,f=i.direction+"Axis "+i.direction+i.n+"Axis",h="flot-"+i.direction+"-axis flot-"+i.direction+i.n+"-axis "+f,d=i.options.font||"flot-tick-label tickLabel",p={x:NaN,y:NaN,width:NaN,height:NaN},m=[],x=function(t,o){return!t||!t.label||t.vi.max?p:(l=u.getTextInfo(h,t.label,d),"x"===i.direction?(a="center",n=g.left+i.p2c(t.v),"bottom"===i.position?e=c.top+c.padding-i.boxPosition.centerY:(e=c.top+c.height-c.padding+i.boxPosition.centerY,r="bottom"),s={x:n-l.width/2-3,y:e-3,width:l.width+6,height:l.height+6}):(r="middle",e=g.top+i.p2c(t.v),"left"===i.position?(n=c.left+c.width-c.padding-i.boxPosition.centerX,a="right"):n=c.left+c.padding+i.boxPosition.centerX,s={x:n-l.width/2-3,y:e-3,width:l.width+6,height:l.height+6}),function(t,i){return i.some((function(i){return o=t.x,n=t.y,e=t.x+t.width,a=t.y+t.height,r=i.x,l=i.y,s=i.x+i.width,c=i.y+i.height,(o<=r&&r<=e||r<=o&&o<=s)&&(n<=l&&l<=a||l<=n&&n<=c);var o,n,e,a,r,l,s,c}))}(s,o)?p:(u.addText(h,n,e,t.label,d,null,null,a,r),s))};if(u.removeText(h),N(k.drawAxis,[i,u]),i.show)switch(i.options.showTickLabels){case"none":break;case"endpoints":m.push(x(i.ticks[0],m)),m.push(x(i.ticks[i.ticks.length-1],m));break;case"major":for(m.push(x(i.ticks[0],m)),m.push(x(i.ticks[i.ticks.length-1],m)),o=1;o=0&&(e=0)}else e=n.min,a=n.max;break;case"exact":e=null!=r?r:n.min,a=null!=l?l:n.max;break;case"sliding-window":l>a&&(a=l,e=Math.max(l-(n.windowSize||100),e))}var c=function(t,i){var o=void 0===t?null:t,n=void 0===i?null:i;if(0===n-o){var e=0===n?1:.01,a=null;null==o&&(a-=e),null!=n&&null==o||(n+=e),null!=a&&(o=a)}return{min:o,max:n}}(e,a);e=c.min,a=c.max,!0===n.growOnly&&"none"!==n.autoScale&&"sliding-window"!==n.autoScale&&(e=el?a:null!==l?l:a),i.autoScaledMin=e,i.autoScaledMax=a}function R(i,o,n,e,a){var r=j(n,u,e),l=t.plot.saturated.delta(i,o,r),s=-Math.floor(Math.log(l)/Math.LN10);a&&s>a&&(s=a);var c=l/parseFloat("1e"+-s);return c>2.25&&c<3&&s+1<=a&&++s,isFinite(s)?s:0}function E(i,o,n,e){var a=t.plot.saturated.delta(i,o,n),r=-Math.floor(Math.log(a)/Math.LN10);e&&r>e&&(r=e);var l,s=parseFloat("1e"+-r),c=a/s;return c<1.5?l=1:c<3?(l=2,c>2.25&&(null==e||r+1<=e)&&(l=2.5)):l=c<7.5?5:10,l*=s}function j(t,i,o){return"number"==typeof o&&o>0?o:.3*Math.sqrt("x"===t?i.width:i.height)}function H(t,i,o,n){if(null===i)switch(n){case"min":case"max":var e=function(t,i){var o=Math.floor(i.p2c(t)),n="x"===i.direction?o+1:o-1,e=i.c2p(o),a=i.c2p(n);return R(e,a,i.direction,1)}(t,o);isFinite(e),i=o.tickFormatter(t,o,e,y);break;case"major":i=o.tickFormatter(t,o,void 0,y)}return{v:t,label:i}}function G(){u.clear(),N(k.drawBackground,[d]);var t=c.grid;t.show&&t.backgroundColor&&(d.save(),d.translate(g.left,g.top),d.fillStyle=it(c.grid.backgroundColor,v,0,"rgba(255, 255, 255, 0)"),d.fillRect(0,0,b,v),d.restore()),t.show&&!t.aboveData&&U();for(var i=0;ie){var s=n;n=e,e=s}return{from:n,to:e,axis:o}}function _(t){var i=t.box,o=0,n=0;return"x"===t.direction?(o=0,n=i.top-g.top+("top"===t.position?i.height:0)):(n=0,o=i.left-g.left+("left"===t.position?i.width:0)+t.boxPosition.centerX),{x:o,y:n}}function X(t,i){return t%2!=0?Math.floor(i)+.5:i}function Y(t){d.lineWidth=1;var i=_(t),o=i.x,n=i.y;if(t.show){var e=0,a=0;d.strokeStyle=t.options.color,d.beginPath(),"x"===t.direction?e=b+1:a=v+1,"x"===t.direction?n=X(d.lineWidth,n):o=X(d.lineWidth,o),d.moveTo(o,n),d.lineTo(o+e,n+a),d.stroke()}}function q(t){var i=t.tickLength,o=t.showMinorTicks,n=S,e=_(t),a=e.x,r=e.y,l=0;for(d.strokeStyle=t.options.color,d.beginPath(),l=0;l=t.min&&c<=t.max&&("x"===t.direction?(a=t.p2c(c),f=i,"top"===t.position&&(f=-f)):(r=t.p2c(c),u=i,"left"===t.position&&(u=-u)),"x"===t.direction?a=X(d.lineWidth,a):r=X(d.lineWidth,r),d.moveTo(a,r),d.lineTo(a+u,r+f)),!0===o&&lb)continue}else if(h=i/2,r=X(d.lineWidth,t.p2c(m+s*x)),"left"===t.position&&(h=-h),r<0||r>v)continue;d.moveTo(a,r),d.lineTo(a+h,r+p)}}}d.stroke()}function B(t){var i,o,n;for(d.strokeStyle=c.grid.tickColor,d.beginPath(),i=0;it.max||(o=e,n=void 0,(!("object"==typeof(n=c.grid.borderWidth)&&n[t.position]>0||n>0)||o!==t.min&&o!==t.max)&&("x"===t.direction?(l=t.p2c(e),s=v,r=-v):(l=0,s=t.p2c(e),a=b),"x"===t.direction?l=X(d.lineWidth,l):s=X(d.lineWidth,s),d.moveTo(l,s),d.lineTo(l+a,s+r)))}d.stroke()}function U(){var i,o;d.save(),d.translate(g.left,g.top),function(){var i,o,n=c.grid.markings;if(n)for(t.isFunction(n)&&((i=y.getAxes()).xmin=i.xaxis.min,i.xmax=i.xaxis.max,i.ymin=i.yaxis.min,i.ymax=i.yaxis.max,n=n(i)),o=0;oa.axis.max||r.tor.axis.max)){a.from=Math.max(a.from,a.axis.min),a.to=Math.min(a.to,a.axis.max),r.from=Math.max(r.from,r.axis.min),r.to=Math.min(r.to,r.axis.max);var l=a.from===a.to,s=r.from===r.to;if(!l||!s)if(a.from=Math.floor(a.axis.p2c(a.from)),a.to=Math.floor(a.axis.p2c(a.to)),r.from=Math.floor(r.axis.p2c(r.from)),r.to=Math.floor(r.axis.p2c(r.to)),l||s){var u=e.lineWidth||c.grid.markingsLineWidth,f=u%2?.5:0;d.beginPath(),d.strokeStyle=e.color||c.grid.markingsColor,d.lineWidth=u,l?(d.moveTo(a.to+f,r.from),d.lineTo(a.to+f,r.to)):(d.moveTo(a.from,r.to+f),d.lineTo(a.to,r.to+f)),d.stroke()}else d.fillStyle=e.color||c.grid.markingsColor,d.fillRect(a.from,r.to,a.to-a.from,r.from-r.to)}}}(),i=z(),o=c.grid.borderWidth;for(var n=0;n0&&(d.strokeStyle=i.top,d.lineWidth=t.top,d.beginPath(),d.moveTo(0-t.left,0-t.top/2),d.lineTo(b,0-t.top/2),d.stroke()),t.right>0&&(d.strokeStyle=i.right,d.lineWidth=t.right,d.beginPath(),d.moveTo(b+t.right/2,0-t.top),d.lineTo(b+t.right/2,v),d.stroke()),t.bottom>0&&(d.strokeStyle=i.bottom,d.lineWidth=t.bottom,d.beginPath(),d.moveTo(b+t.right,v+t.bottom/2),d.lineTo(0,v+t.bottom/2),d.stroke()),t.left>0&&(d.strokeStyle=i.left,d.lineWidth=t.left,d.beginPath(),d.moveTo(0-t.left/2,v+t.bottom),d.lineTo(0-t.left/2,0),d.stroke())):(d.lineWidth=t,d.strokeStyle=c.grid.borderColor,d.strokeRect(-t/2,-t/2,b+t,v+t))}(),d.restore()}function K(i){i.lines.show&&t.plot.drawSeries.drawSeriesLines(i,d,g,b,v,y.drawSymbol,it),i.bars.show&&t.plot.drawSeries.drawSeriesBars(i,d,g,b,v,y.drawSymbol,it),i.points.show&&t.plot.drawSeries.drawSeriesPoints(i,d,g,b,v,y.drawSymbol,it)}function Q(t,i,o,n,e){for(var a=function(t,i,o,n,e){var a,r=[],l=[],c=n*n+1;for(a=s.length-1;a>=0;--a)if(o(a)){var u=s[a];if(!u.datapoints)return;var f=!1;if(u.lines.show||u.points.show){var h=$(u,t,i,n,e);h&&(l.push({seriesIndex:a,dataIndex:h.dataIndex,distance:h.distance}),f=!0)}if(u.bars.show&&!f){var d=J(u,t,i);d>=0&&l.push({seriesIndex:a,dataIndex:d,distance:c})}}for(a=0;avoid 0===i.distance?-1:void 0===t.distance&&void 0!==i.distance?1:t.distance-i.distance)}function $(t,i,o,n,e){var a=t.xaxis.c2p(i),r=t.yaxis.c2p(o),l=n/t.xaxis.scale,s=n/t.yaxis.scale,c=t.datapoints.points,u=t.datapoints.pointsize,f=Number.POSITIVE_INFINITY;t.xaxis.options.inverseTransform&&(l=Number.MAX_VALUE),t.yaxis.options.inverseTransform&&(s=Number.MAX_VALUE);for(var h=null,d=0;dl||p-a<-l||m-r>s||m-r<-s)){var x=Math.abs(t.xaxis.p2c(p)-i),g=Math.abs(t.yaxis.p2c(m)-o),b=e?e(x,g):x*x+g*g;bt.yaxis.min?Math.min(t.yaxis.max,u):t.yaxis.min,h=-1,d=0;d=Math.min(x,p)&&l>=m+n&&l<=m+e:r>=p+n&&r<=p+e&&l>=Math.min(x,m)&&l<=Math.max(x,m))&&(h=d/c)}}return h}function Z(){var t=c.interaction.redrawOverlayInterval;-1!==t?M||(M=setTimeout((function(){tt(y)}),t)):tt()}function tt(t){if(M=null,p){f.clear(),N(k.drawOverlay,[p,f]);var i=new CustomEvent("onDrawingDone");t.getEventHolder().dispatchEvent(i),t.getPlaceholder().trigger("drawingdone")}}function it(i,o,n,e){if("string"==typeof i)return i;for(var a=d.createLinearGradient(0,n,0,o),r=0,l=i.colors.length;r opts.zoomRange[1]) { + continue; + } + } + var offsetBelow = $.plot.saturated.saturate(navigationOffset.below - (axis.min - min)); var offsetAbove = $.plot.saturated.saturate(navigationOffset.above - (axis.max - max)); opts.offset = { below: offsetBelow, above: offsetAbove }; @@ -521,6 +541,14 @@ return; } + // calc min delta (revealing left edge of plot) + var minD = axis.p2c(opts.panRange[0]) - axis.p2c(axis.min); + // calc max delta (revealing right edge of plot) + var maxD = axis.p2c(opts.panRange[1]) - axis.p2c(axis.max); + // limit delta to min or max if enabled + if (opts.panRange[0] !== undefined && d >= maxD) d = maxD; + if (opts.panRange[1] !== undefined && d <= minD) d = minD; + if (d !== 0) { var navigationOffsetBelow = saturated.saturate(axis.c2p(axis.p2c(axis.min) + d) - axis.c2p(axis.p2c(axis.min))), navigationOffsetAbove = saturated.saturate(axis.c2p(axis.p2c(axis.max) + d) - axis.c2p(axis.p2c(axis.max))); @@ -675,6 +703,14 @@ return; } + // calc min delta (revealing left edge of plot) + var minD = p + axis.p2c(opts.panRange[0]) - axis.p2c(axisMin); + // calc max delta (revealing right edge of plot) + var maxD = p + axis.p2c(opts.panRange[1]) - axis.p2c(axisMax); + // limit delta to min or max if enabled + if (opts.panRange[0] !== undefined && d >= maxD) d = maxD; + if (opts.panRange[1] !== undefined && d <= minD) d = minD; + if (d !== 0) { var navigationOffsetBelow = saturated.saturate(axis.c2p(axis.p2c(axisMin) - (p - d)) - axis.c2p(axis.p2c(axisMin))), navigationOffsetAbove = saturated.saturate(axis.c2p(axis.p2c(axisMax) - (p - d)) - axis.c2p(axis.p2c(axisMax))); diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.navigate.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.navigate.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.navigate.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -!function(t){"use strict";var e=t.plot.saturated,a=t.plot.browser,o=t.plot.uiConstants.SNAPPING_CONSTANT,n=t.plot.uiConstants.PANHINT_LENGTH_CONSTANT;function i(i,r){var s=null,f=!1,l="manual"===r.pan.mode,u="smartLock"===r.pan.mode,c=u||"smart"===r.pan.mode;var p,d="default",g=null,x=null,v={x:0,y:0},m=!1;function h(t,e){var o=Math.abs(t.originalEvent.deltaY)<=1?1+Math.abs(t.originalEvent.deltaY)/50:null;if(m&&M(t),i.getOptions().zoom.active)return t.preventDefault(),function(t,e,o){var n=a.getPageXY(t),r=i.offset();r.left=n.X-r.left,r.top=n.Y-r.top;var s=i.getPlaceholder().offset();s.left=n.X-s.left,s.top=n.Y-s.top;var f=i.getXAxes().concat(i.getYAxes()).filter((function(t){var e=t.box;if(void 0!==e)return s.left>e.left&&s.lefte.top&&s.tope.left&&o.lefte.top&&o.top(x=t.plot.saturated.saturate(p.c2p(x)))){var m=g;g=x,x=m}var h=t.plot.saturated.saturate(v.below-(p.min-g)),b=t.plot.saturated.saturate(v.above-(p.max-x));d.offset={below:h,above:b}}}i.setupGrid(!0),i.draw(),e.preventEvent||i.getPlaceholder().trigger("plotzoom",[i,e])},i.pan=function(a){var o={x:+a.left,y:+a.top};isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0),t.each(a.axes||i.getAxes(),(function(t,n){var i=n.options,r=o[n.direction];if((i.axisPan||!a.axes)&&(i.plotPan||a.axes)&&0!==r){var s=e.saturate(n.c2p(n.p2c(n.min)+r)-n.c2p(n.p2c(n.min))),f=e.saturate(n.c2p(n.p2c(n.max)+r)-n.c2p(n.p2c(n.max)));isFinite(s)||(s=0),isFinite(f)||(f=0),i.offset={below:e.saturate(s+(i.offset.below||0)),above:e.saturate(f+(i.offset.above||0))}}})),i.setupGrid(!0),i.draw(),a.preventEvent||i.getPlaceholder().trigger("plotpan",[i,a])},i.recenter=function(e){t.each(e.axes||i.getAxes(),(function(t,a){e.axes?"x"===this.direction?a.options.offset={below:0}:"y"===this.direction&&(a.options.offset={above:0}):a.options.offset={below:0,above:0}})),i.setupGrid(!0),i.draw()};var X=null,T={x:0,y:0};i.smartPan=function(t,a,n,r,s){var f,l,u,c,p,d,x=!!s||function(t){return Math.abs(t.y)=o||Math.abs(t.x)=o}(t),v=i.getAxes();(function(t){return Math.abs(t.x)>0&&Math.abs(t.y)>0})(t=s?function(t){switch(!X&&Math.max(Math.abs(t.x),Math.abs(t.y))>=o&&(X=Math.abs(t.x)=o?{x:0,y:t.y}:Math.abs(t.y)=o?{x:t.x,y:0}:t}(t))&&(a.diagMode=!0),x&&!0===a.diagMode&&(a.diagMode=!1,function(t,e,a){var o;Object.keys(t).forEach((function(n){o=t[n],0===a[o.direction]&&(o.options.offset.below=e[n].navigationOffset.below,o.options.offset.above=e[n].navigationOffset.above)}))}(v,a,t)),g=x?{start:{x:a.startPageX-i.offset().left+i.getPlotOffset().left,y:a.startPageY-i.offset().top+i.getPlotOffset().top},end:{x:a.startPageX-t.x-i.offset().left+i.getPlotOffset().left,y:a.startPageY-t.y-i.offset().top+i.getPlotOffset().top}}:{start:{x:a.startPageX-i.offset().left+i.getPlotOffset().left,y:a.startPageY-i.offset().top+i.getPlotOffset().top},end:!1},isNaN(t.x)&&(t.x=0),isNaN(t.y)&&(t.y=0),n&&(v=n),Object.keys(v).forEach((function(a){if(l=v[a],u=l.min,c=l.max,f=l.options,d=t[l.direction],p=T[l.direction],(f.axisPan||!n)&&(n||f.plotPan)&&0!==d){var o=e.saturate(l.c2p(l.p2c(u)-(p-d))-l.c2p(l.p2c(u))),i=e.saturate(l.c2p(l.p2c(c)-(p-d))-l.c2p(l.p2c(c)));isFinite(o)||(o=0),isFinite(i)||(i=0),l.options.offset.below=e.saturate(o+(l.options.offset.below||0)),l.options.offset.above=e.saturate(i+(l.options.offset.above||0))}})),T=t,i.setupGrid(!0),i.draw(),r||i.getPlaceholder().trigger("plotpan",[i,t,n,a])},i.smartPan.end=function(){g=null,X=null,T={x:0,y:0},i.triggerRedrawOverlay()},i.getTouchedAxis=function(t,e){var a=i.getPlaceholder().offset();return a.left=t-a.left,a.top=e-a.top,i.getXAxes().concat(i.getYAxes()).filter((function(t){var e=t.box;if(void 0!==e)return a.left>e.left&&a.lefte.top&&a.tope.left&&s.lefte.top&&s.tope.left&&n.lefte.top&&n.top(v=t.plot.saturated.saturate(p.c2p(v)))){var m=g;g=v,v=m}if(d.zoomRange){if(v-gd.zoomRange[1])continue}var h=t.plot.saturated.saturate(x.below-(p.min-g)),b=t.plot.saturated.saturate(x.above-(p.max-v));d.offset={below:h,above:b}}}e.setupGrid(!0),e.draw(),a.preventEvent||e.getPlaceholder().trigger("plotzoom",[e,a])},e.pan=function(o){var n={x:+o.left,y:+o.top};isNaN(n.x)&&(n.x=0),isNaN(n.y)&&(n.y=0),t.each(o.axes||e.getAxes(),(function(t,e){var i=e.options,r=n[e.direction];if((i.axisPan||!o.axes)&&(i.plotPan||o.axes)){var s=e.p2c(i.panRange[0])-e.p2c(e.min),f=e.p2c(i.panRange[1])-e.p2c(e.max);if(void 0!==i.panRange[0]&&r>=f&&(r=f),void 0!==i.panRange[1]&&r<=s&&(r=s),0!==r){var c=a.saturate(e.c2p(e.p2c(e.min)+r)-e.c2p(e.p2c(e.min))),l=a.saturate(e.c2p(e.p2c(e.max)+r)-e.c2p(e.p2c(e.max)));isFinite(c)||(c=0),isFinite(l)||(l=0),i.offset={below:a.saturate(c+(i.offset.below||0)),above:a.saturate(l+(i.offset.above||0))}}}})),e.setupGrid(!0),e.draw(),o.preventEvent||e.getPlaceholder().trigger("plotpan",[e,o])},e.recenter=function(a){t.each(a.axes||e.getAxes(),(function(t,e){a.axes?"x"===this.direction?e.options.offset={below:0}:"y"===this.direction&&(e.options.offset={above:0}):e.options.offset={below:0,above:0}})),e.setupGrid(!0),e.draw()};var X=null,T={x:0,y:0};e.smartPan=function(t,o,i,r,s){var f,c,l,u,p,d,v=!!s||function(t){return Math.abs(t.y)=n||Math.abs(t.x)=n}(t),x=e.getAxes();(function(t){return Math.abs(t.x)>0&&Math.abs(t.y)>0})(t=s?function(t){switch(!X&&Math.max(Math.abs(t.x),Math.abs(t.y))>=n&&(X=Math.abs(t.x)=n?{x:0,y:t.y}:Math.abs(t.y)=n?{x:t.x,y:0}:t}(t))&&(o.diagMode=!0),v&&!0===o.diagMode&&(o.diagMode=!1,function(t,e,a){var o;Object.keys(t).forEach((function(n){o=t[n],0===a[o.direction]&&(o.options.offset.below=e[n].navigationOffset.below,o.options.offset.above=e[n].navigationOffset.above)}))}(x,o,t)),g=v?{start:{x:o.startPageX-e.offset().left+e.getPlotOffset().left,y:o.startPageY-e.offset().top+e.getPlotOffset().top},end:{x:o.startPageX-t.x-e.offset().left+e.getPlotOffset().left,y:o.startPageY-t.y-e.offset().top+e.getPlotOffset().top}}:{start:{x:o.startPageX-e.offset().left+e.getPlotOffset().left,y:o.startPageY-e.offset().top+e.getPlotOffset().top},end:!1},isNaN(t.x)&&(t.x=0),isNaN(t.y)&&(t.y=0),i&&(x=i),Object.keys(x).forEach((function(e){if(c=x[e],l=c.min,u=c.max,f=c.options,d=t[c.direction],p=T[c.direction],(f.axisPan||!i)&&(i||f.plotPan)){var o=p+c.p2c(f.panRange[0])-c.p2c(l),n=p+c.p2c(f.panRange[1])-c.p2c(u);if(void 0!==f.panRange[0]&&d>=n&&(d=n),void 0!==f.panRange[1]&&d<=o&&(d=o),0!==d){var r=a.saturate(c.c2p(c.p2c(l)-(p-d))-c.c2p(c.p2c(l))),s=a.saturate(c.c2p(c.p2c(u)-(p-d))-c.c2p(c.p2c(u)));isFinite(r)||(r=0),isFinite(s)||(s=0),c.options.offset.below=a.saturate(r+(c.options.offset.below||0)),c.options.offset.above=a.saturate(s+(c.options.offset.above||0))}}})),T=t,e.setupGrid(!0),e.draw(),r||e.getPlaceholder().trigger("plotpan",[e,t,i,o])},e.smartPan.end=function(){g=null,X=null,T={x:0,y:0},e.triggerRedrawOverlay()},e.getTouchedAxis=function(t,a){var o=e.getPlaceholder().offset();return o.left=t-o.left,o.top=a-o.top,e.getXAxes().concat(e.getYAxes()).filter((function(t){var e=t.box;if(void 0!==e)return o.left>e.left&&o.lefte.top&&o.top"+e+"
"+Math.round(i.percent)+"%"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,color:null,label:"Other"},highlight:{opacity:.5}}}};e.plot.plugins.push({init:function(t){var r=null,a=null,l=null,n=null,o=null,p=null,h=!1,g=null,c=[];function u(i,s,t){h||(h=!0,r=i.getCanvas(),a=e(r).parent(),l=i.getOptions(),i.setData(function(i){var s,t,r=0,a=0,n=0,o=l.series.pie.combine.color,p=[];for(s=0;sl.series.pie.combine.threshold)&&p.push(e.extend(i[s],{data:[[1,t]],color:i[s].color,label:i[s].label,angle:t*Math.PI*2/r,percent:t/(r/100)}));n>1&&p.push({data:[[1,a]],color:o,label:l.series.pie.combine.label,angle:a*Math.PI*2/r,percent:a/(r/100)});return p}(i.getData())))}function d(t,r){if(a){var c=t.getPlaceholder().width(),u=t.getPlaceholder().height(),d=a.children().filter(".legend").children().width()||0;g=r,h=!1,n=Math.min(c,u/l.series.pie.tilt)/2,p=u/2+l.series.pie.offset.top,o=c/2,"auto"===l.series.pie.offset.left?(l.legend.position.match("w")?o+=d/2:o-=d/2,oc-n&&(o=c-n)):o+=l.series.pie.offset.left;var v=t.getData(),b=0;do{b>0&&(n*=s),b+=1,w(),l.series.pie.tilt<=.8&&k()}while(!M()&&b=i&&(w(),a.prepend("
Could not draw pie with labels contained inside canvas
")),t.setSeries&&t.insertLegend&&(t.setSeries(v),t.insertLegend())}function w(){g.clearRect(0,0,c,u),a.children().filter(".pieLabel, .pieLabelBackground").remove()}function k(){var e=l.series.pie.shadow.left,i=l.series.pie.shadow.top,s=l.series.pie.shadow.alpha,t=l.series.pie.radius>1?l.series.pie.radius:n*l.series.pie.radius;if(!(t>=c/2-e||t*l.series.pie.tilt>=u/2-i||t<=10)){g.save(),g.translate(e,i),g.globalAlpha=s,g.fillStyle="#000",g.translate(o,p),g.scale(1,l.series.pie.tilt);for(var r=1;r<=10;r++)g.beginPath(),g.arc(0,0,t,0,2*Math.PI,!1),g.fill(),t-=r;g.restore()}}function M(){var i,s=Math.PI*l.series.pie.startAngle,t=l.series.pie.radius>1?l.series.pie.radius:n*l.series.pie.radius;g.save(),g.translate(o,p),g.scale(1,l.series.pie.tilt),g.save();var r=s;for(i=0;i0){for(g.save(),g.lineWidth=l.series.pie.stroke.width,r=s,i=0;i1?l.series.pie.label.radius:n*l.series.pie.label.radius,r=0;r=100*l.series.pie.label.threshold&&!h(v[r],i,r))return!1;i+=v[r].angle}return!0;function h(i,s,r){if(0===i.data[0][1])return!0;var n,h=l.legend.labelFormatter,g=l.series.pie.label.formatter;n=h?h(i.label,i):i.label,g&&(n=g(n,i));var d=(s+i.angle+s)/2,f=o+Math.round(Math.cos(d)*t),v=p+Math.round(Math.sin(d)*t)*l.series.pie.tilt,b=""+n+"";a.append(b);var w=a.children("#pieLabel"+r),k=v-w.height()/2,M=f-w.width()/2;if(w.css("top",k),w.css("left",M),0-k>0||0-M>0||u-(k+w.height())<0||c-(M+w.width())<0)return!1;if(0!==l.series.pie.label.background.opacity){var P=l.series.pie.label.background.color;null==P&&(P=i.color);var A="top:"+k+"px;left:"+M+"px;";e("
").css("opacity",l.series.pie.label.background.opacity).insertBefore(w)}return!0}}();function h(e,i,s){e<=0||isNaN(e)||(s?g.fillStyle=i:(g.strokeStyle=i,g.lineJoin="round"),g.beginPath(),Math.abs(e-2*Math.PI)>1e-9&&g.moveTo(0,0),g.arc(0,0,t,r,r+e/2,!1),g.arc(0,0,t,r+e/2,r+e,!1),g.closePath(),r+=e,s?g.fill():g.stroke())}}}function f(e){if(l.series.pie.innerRadius>0){e.save();var i=l.series.pie.innerRadius>1?l.series.pie.innerRadius:n*l.series.pie.innerRadius;e.globalCompositeOperation="destination-out",e.beginPath(),e.fillStyle=l.series.pie.stroke.color,e.arc(0,0,i,0,2*Math.PI,!1),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.strokeStyle=l.series.pie.stroke.color,e.arc(0,0,i,0,2*Math.PI,!1),e.stroke(),e.closePath(),e.restore()}}function v(e,i){for(var s=!1,t=-1,r=e.length,a=r-1;++t1?l.series.pie.radius:n*l.series.pie.radius,c=0;c1?i.series.pie.tilt=1:i.series.pie.tilt<0&&(i.series.pie.tilt=0))})),t.hooks.bindEvents.push((function(e,i){var s=e.getOptions();s.series.pie.show&&(s.grid.hoverable&&i.unbind("mousemove").mousemove(b),s.grid.clickable&&i.unbind("click").click(w))})),t.hooks.processDatapoints.push((function(e,i,s,t){e.getOptions().series.pie.show&&u(e,i,s)})),t.hooks.drawOverlay.push((function(e,i){e.getOptions().series.pie.show&&function(e,i){var s=e.getOptions(),t=s.series.pie.radius>1?s.series.pie.radius:n*s.series.pie.radius;i.save(),i.translate(o,p),i.scale(1,s.series.pie.tilt);for(var r=0;r1e-9&&i.moveTo(0,0),i.arc(0,0,t,e.startAngle,e.startAngle+e.angle/2,!1),i.arc(0,0,t,e.startAngle+e.angle/2,e.startAngle+e.angle,!1),i.closePath(),i.fill())}f(i),i.restore()}(e,i)})),t.hooks.draw.push((function(e,i){e.getOptions().series.pie.show&&d(e,i)}))},options:t,name:"pie",version:"1.1"})}(jQuery); +!function(e){var i=10,s=.95;var t={series:{pie:{show:!1,radius:"auto",innerRadius:0,startAngle:1.5,tilt:1,shadow:{left:5,top:15,alpha:.02},offset:{top:0,left:"auto"},stroke:{color:"#fff",width:1},label:{show:"auto",formatter:function(e,i){return"
"+e+"
"+Math.round(i.percent)+"%
"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,color:null,label:"Other"},highlight:{opacity:.5}}}};e.plot.plugins.push({init:function(t){var r=null,a=null,l=null,n=null,o=null,p=null,h=!1,u=null,c=[];function g(i,s,t){h||(h=!0,r=i.getCanvas(),a=e(r).parent(),l=i.getOptions(),i.setData(function(i){var s,t,r=0,a=0,n=0,o=l.series.pie.combine.color,p=[];for(s=0;sl.series.pie.combine.threshold)&&p.push(e.extend(i[s],{data:[[1,t]],color:i[s].color,label:i[s].label,angle:t*Math.PI*2/r,percent:t/(r/100)}));n>1&&p.push({data:[[1,a]],color:o,label:l.series.pie.combine.label,angle:a*Math.PI*2/r,percent:a/(r/100)});return p}(i.getData())))}function d(t,r){if(a){var c=t.getPlaceholder().width(),g=t.getPlaceholder().height(),d=a.children().filter(".legend").children().width()||0;u=r,h=!1,n=Math.min(c,g/l.series.pie.tilt)/2,p=g/2+l.series.pie.offset.top,o=c/2,"auto"===l.series.pie.offset.left?(l.legend.position.match("w")?o+=d/2:o-=d/2,oc-n&&(o=c-n)):o+=l.series.pie.offset.left;var v=t.getData(),b=0;do{b>0&&(n*=s),b+=1,w(),l.series.pie.tilt<=.8&&k()}while(!M()&&b=i&&(w(),a.prepend("
Could not draw pie with labels contained inside canvas
")),t.setSeries&&t.insertLegend&&(t.setSeries(v),t.insertLegend())}function w(){u.clearRect(0,0,c,g),a.children().filter(".pieLabel, .pieLabelBackground").remove()}function k(){var e=l.series.pie.shadow.left,i=l.series.pie.shadow.top,s=l.series.pie.shadow.alpha,t=l.series.pie.radius>1?l.series.pie.radius:n*l.series.pie.radius;if(!(t>=c/2-e||t*l.series.pie.tilt>=g/2-i||t<=10)){u.save(),u.translate(e,i),u.globalAlpha=s,u.fillStyle="#000",u.translate(o,p),u.scale(1,l.series.pie.tilt);for(var r=1;r<=10;r++)u.beginPath(),u.arc(0,0,t,0,2*Math.PI,!1),u.fill(),t-=r;u.restore()}}function M(){var i,s=Math.PI*l.series.pie.startAngle,t=l.series.pie.radius>1?l.series.pie.radius:n*l.series.pie.radius;u.save(),u.translate(o,p),u.scale(1,l.series.pie.tilt),u.save();var r=s;for(i=0;i0){for(u.save(),u.lineWidth=l.series.pie.stroke.width,r=s,i=0;i1?l.series.pie.label.radius:n*l.series.pie.label.radius,r=0;r=100*l.series.pie.label.threshold&&!h(v[r],i,r))return!1;i+=v[r].angle}return!0;function h(i,s,r){if(0===i.data[0][1])return!0;var n,h=l.legend.labelFormatter,u=l.series.pie.label.formatter;n=h?h(i.label,i):i.label,u&&(n=u(n,i));var d=(s+i.angle+s)/2,f=o+Math.round(Math.cos(d)*t),v=p+Math.round(Math.sin(d)*t)*l.series.pie.tilt,b=""+n+"";a.append(b);var w=a.children("#pieLabel"+r),k=v-w.height()/2,M=f-w.width()/2;if(w.css("top",k),w.css("left",M),0-k>0||0-M>0||g-(k+w.height())<0||c-(M+w.width())<0)return!1;if(0!==l.series.pie.label.background.opacity){var m=l.series.pie.label.background.color;null==m&&(m=i.color);var P="top:"+k+"px;left:"+M+"px;";e("
").css("opacity",l.series.pie.label.background.opacity).insertBefore(w)}return!0}}();function h(e,i,s){e<=0||isNaN(e)||(s?u.fillStyle=i:(u.strokeStyle=i,u.lineJoin="round"),u.beginPath(),Math.abs(e-2*Math.PI)>1e-9&&u.moveTo(0,0),u.arc(0,0,t,r,r+e/2,!1),u.arc(0,0,t,r+e/2,r+e,!1),u.closePath(),r+=e,s?u.fill():u.stroke())}}}function f(e){if(l.series.pie.innerRadius>0){e.save();var i=l.series.pie.innerRadius>1?l.series.pie.innerRadius:n*l.series.pie.innerRadius;e.globalCompositeOperation="destination-out",e.beginPath(),e.fillStyle=l.series.pie.stroke.color,e.arc(0,0,i,0,2*Math.PI,!1),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.strokeStyle=l.series.pie.stroke.color,e.arc(0,0,i,0,2*Math.PI,!1),e.stroke(),e.closePath(),e.restore()}}function v(e,i){for(var s=!1,t=-1,r=e.length,a=r-1;++t1?l.series.pie.radius:n*l.series.pie.radius,c=0;c1?i.series.pie.tilt=1:i.series.pie.tilt<0&&(i.series.pie.tilt=0))})),t.hooks.bindEvents.push((function(e,i){var s=e.getOptions();s.series.pie.show&&(s.grid.hoverable&&(i.unbind("mousemove").mousemove(b),i.bind("mouseleave",b)),s.grid.clickable&&i.unbind("click").click(w))})),t.hooks.shutdown.push((function(e,i){i.unbind("mousemove",b),i.unbind("mouseleave",b),i.unbind("click",w),c=[]})),t.hooks.processDatapoints.push((function(e,i,s,t){e.getOptions().series.pie.show&&g(e,i,s)})),t.hooks.drawOverlay.push((function(e,i){e.getOptions().series.pie.show&&function(e,i){var s=e.getOptions(),t=s.series.pie.radius>1?s.series.pie.radius:n*s.series.pie.radius;i.save(),i.translate(o,p),i.scale(1,s.series.pie.tilt);for(var r=0;r1e-9&&i.moveTo(0,0),i.arc(0,0,t,e.startAngle,e.startAngle+e.angle/2,!1),i.arc(0,0,t,e.startAngle+e.angle/2,e.startAngle+e.angle,!1),i.closePath(),i.fill())}f(i),i.restore()}(e,i)})),t.hooks.draw.push((function(e,i){e.getOptions().series.pie.show&&d(e,i)}))},options:t,name:"pie",version:"1.1"})}(jQuery); diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.resize.js --- a/src/myams/resources/js/ext/flot/jquery.flot.resize.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.resize.js Fri Dec 11 11:45:23 2020 +0100 @@ -20,7 +20,7 @@ * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ -(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this); +(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,window); /* eslint-enable */ (function ($) { diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.resize.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.resize.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.resize.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -!function(e,t,i){var n,a=[],r=e.resize=e.extend(e.resize,{}),o=!1,s="setTimeout",u="resize",h=u+"-special-event",m="pendingDelay",l="activeDelay",c="throttleWindow";function d(i){!0===o&&(o=i||1);for(var s=a.length-1;s>=0;s--){var l=e(a[s]);if(l[0]==t||l.is(":visible")){var c=l.width(),f=l.height(),g=l.data(h);!g||c===g.w&&f===g.h||(l.trigger(u,[g.w=c,g.h=f]),o=i||!0)}else(g=l.data(h)).w=0,g.h=0}null!==n&&(o&&(null==i||i-o<1e3)?n=t.requestAnimationFrame(d):(n=setTimeout(d,r[m]),o=!1))}r[m]=200,r[l]=20,r[c]=!0,e.event.special[u]={setup:function(){if(!r[c]&&this[s])return!1;var t=e(this);a.push(this),t.data(h,{w:t.width(),h:t.height()}),1===a.length&&(n=i,d())},teardown:function(){if(!r[c]&&this[s])return!1;for(var t=e(this),i=a.length-1;i>=0;i--)if(a[i]==this){a.splice(i,1);break}t.removeData(h),a.length||(o?cancelAnimationFrame(n):clearTimeout(n),n=null)},add:function(t){if(!r[c]&&this[s])return!1;var n;function a(t,a,r){var o=e(this),s=o.data(h)||{};s.w=a!==i?a:o.width(),s.h=r!==i?r:o.height(),n.apply(this,arguments)}if(e.isFunction(t))return n=t,a;n=t.handler,t.handler=a}},t.requestAnimationFrame||(t.requestAnimationFrame=t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(e,i){return t.setTimeout((function(){e((new Date).getTime())}),r[l])}),t.cancelAnimationFrame||(t.cancelAnimationFrame=t.webkitCancelRequestAnimationFrame||t.mozCancelRequestAnimationFrame||t.oCancelRequestAnimationFrame||t.msCancelRequestAnimationFrame||clearTimeout)}(jQuery,this),jQuery.plot.plugins.push({init:function(e){function t(){var t=e.getPlaceholder();0!==t.width()&&0!==t.height()&&(e.resize(),e.setupGrid(),e.draw())}e.hooks.bindEvents.push((function(e,i){e.getPlaceholder().resize(t)})),e.hooks.shutdown.push((function(e,i){e.getPlaceholder().unbind("resize",t)}))},options:{},name:"resize",version:"1.0"}); +!function(e,t,i){var n,a=[],r=e.resize=e.extend(e.resize,{}),o=!1,s="setTimeout",u="resize",h=u+"-special-event",m="pendingDelay",l="activeDelay",c="throttleWindow";function d(i){!0===o&&(o=i||1);for(var s=a.length-1;s>=0;s--){var l=e(a[s]);if(l[0]==t||l.is(":visible")){var c=l.width(),f=l.height(),w=l.data(h);!w||c===w.w&&f===w.h||(l.trigger(u,[w.w=c,w.h=f]),o=i||!0)}else(w=l.data(h)).w=0,w.h=0}null!==n&&(o&&(null==i||i-o<1e3)?n=t.requestAnimationFrame(d):(n=setTimeout(d,r[m]),o=!1))}r[m]=200,r[l]=20,r[c]=!0,e.event.special[u]={setup:function(){if(!r[c]&&this[s])return!1;var t=e(this);a.push(this),t.data(h,{w:t.width(),h:t.height()}),1===a.length&&(n=i,d())},teardown:function(){if(!r[c]&&this[s])return!1;for(var t=e(this),i=a.length-1;i>=0;i--)if(a[i]==this){a.splice(i,1);break}t.removeData(h),a.length||(o?cancelAnimationFrame(n):clearTimeout(n),n=null)},add:function(t){if(!r[c]&&this[s])return!1;var n;function a(t,a,r){var o=e(this),s=o.data(h)||{};s.w=a!==i?a:o.width(),s.h=r!==i?r:o.height(),n.apply(this,arguments)}if(e.isFunction(t))return n=t,a;n=t.handler,t.handler=a}},t.requestAnimationFrame||(t.requestAnimationFrame=t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(e,i){return t.setTimeout((function(){e((new Date).getTime())}),r[l])}),t.cancelAnimationFrame||(t.cancelAnimationFrame=t.webkitCancelRequestAnimationFrame||t.mozCancelRequestAnimationFrame||t.oCancelRequestAnimationFrame||t.msCancelRequestAnimationFrame||clearTimeout)}(jQuery,window),jQuery.plot.plugins.push({init:function(e){function t(){var t=e.getPlaceholder();0!==t.width()&&0!==t.height()&&(e.resize(),e.setupGrid(),e.draw())}e.hooks.bindEvents.push((function(e,i){e.getPlaceholder().resize(t)})),e.hooks.shutdown.push((function(e,i){e.getPlaceholder().unbind("resize",t)}))},options:{},name:"resize",version:"1.0"}); diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.selection.js --- a/src/myams/resources/js/ext/flot/jquery.flot.selection.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.selection.js Fri Dec 11 11:45:23 2020 +0100 @@ -10,6 +10,7 @@ color: color, shape: "round" or "miter" or "bevel", visualization: "fill" or "focus", + displaySelectionDecorations: true or false, minSize: number of pixels } @@ -26,6 +27,10 @@ the selected area clear. The option "fill" highlights (i.e., fills) the selected area with a colored highlight. +There are optional selection decorations (handles) that are rendered with the +"focus" visualization option. The selection decoration is rendered by default +but can be turned off by setting displaySelectionDecorations to false. + "minSize" is the minimum size a selection can be in pixels. This value can be customized to determine the smallest size a selection can be and still have the selection rectangle be displayed. When customizing this value, the @@ -104,9 +109,7 @@ // make this plugin much slimmer. var savedhandlers = {}; - var mouseUpHandler = null; - - function onMouseMove(e) { + function onDrag(e) { if (selection.active) { updateSelection(e); @@ -114,7 +117,7 @@ } } - function onMouseDown(e) { + function onDragStart(e) { var o = plot.getOptions(); // only accept left-click if (e.which !== 1 || o.selection.mode === null) return; @@ -138,17 +141,9 @@ setSelectionPos(selection.first, e); selection.active = true; - - // this is a bit silly, but we have to use a closure to be - // able to whack the same handler again - mouseUpHandler = function (e) { onMouseUp(e); }; - - $(document).one("mouseup", mouseUpHandler); } - function onMouseUp(e) { - mouseUpHandler = null; - + function onDragEnd(e) { // revert drag stuff for old-school browsers if (document.onselectstart !== undefined) { document.onselectstart = savedhandlers.onselectstart; @@ -360,8 +355,9 @@ plot.hooks.bindEvents.push(function(plot, eventHolder) { var o = plot.getOptions(); if (o.selection.mode != null) { - eventHolder.mousemove(onMouseMove); - eventHolder.mousedown(onMouseDown); + plot.addEventHandler("dragstart", onDragStart, eventHolder, 0); + plot.addEventHandler("drag", onDrag, eventHolder, 0); + plot.addEventHandler("dragend", onDragEnd, eventHolder, 0); } }); @@ -459,6 +455,7 @@ var c = $.color.parse(o.selection.color); var visualization = o.selection.visualization; + var displaySelectionDecorations = o.selection.displaySelectionDecorations; var scalingFactor = 1; @@ -495,7 +492,10 @@ } else { ctx.fillRect(0, 0, plot.width(), plot.height()); ctx.clearRect(x, y, w, h); - drawSelectionDecorations(ctx, x, y, w, h, oX, oY, selectionDirection(plot)); + + if (displaySelectionDecorations) { + drawSelectionDecorations(ctx, x, y, w, h, oX, oY, selectionDirection(plot)); + } } ctx.restore(); @@ -503,12 +503,9 @@ }); plot.hooks.shutdown.push(function (plot, eventHolder) { - eventHolder.unbind("mousemove", onMouseMove); - eventHolder.unbind("mousedown", onMouseDown); - - if (mouseUpHandler) { - $(document).unbind("mouseup", mouseUpHandler); - } + eventHolder.unbind("dragstart", onDragStart); + eventHolder.unbind("drag", onDrag); + eventHolder.unbind("dragend", onDragEnd); }); } @@ -518,6 +515,7 @@ selection: { mode: null, // one of null, "x", "y" or "xy" visualization: "focus", // "focus" or "fill" + displaySelectionDecorations: true, // true or false (currently only relevant for the focus visualization) color: "#888888", shape: "round", // one of "round", "miter", or "bevel" minSize: 5 // minimum number of pixels diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.selection.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.selection.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.selection.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -!function(e){e.plot.plugins.push({init:function(o){var t={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,currentMode:"xy",active:!1},n=e.plot.uiConstants.SNAPPING_CONSTANT,i={},l=null;function s(e){t.active&&(h(e),o.getPlaceholder().trigger("plotselecting",[c()]))}function r(n){var s=o.getOptions();1===n.which&&null!==s.selection.mode&&(t.currentMode="xy",document.body.focus(),void 0!==document.onselectstart&&null==i.onselectstart&&(i.onselectstart=document.onselectstart,document.onselectstart=function(){return!1}),void 0!==document.ondrag&&null==i.ondrag&&(i.ondrag=document.ondrag,document.ondrag=function(){return!1}),f(t.first,n),t.active=!0,l=function(e){!function(e){l=null,void 0!==document.onselectstart&&(document.onselectstart=i.onselectstart);void 0!==document.ondrag&&(document.ondrag=i.ondrag);t.active=!1,h(e),m()?a():(o.getPlaceholder().trigger("plotunselected",[]),o.getPlaceholder().trigger("plotselecting",[null]))}(e)},e(document).one("mouseup",l))}function c(){if(!m())return null;if(!t.show)return null;var n={},i={x:t.first.x,y:t.first.y},l={x:t.second.x,y:t.second.y};return"x"===d(o)&&(i.y=0,l.y=o.height()),"y"===d(o)&&(i.x=0,l.x=o.width()),e.each(o.getAxes(),(function(e,o){if(o.used){var t=o.c2p(i[o.direction]),s=o.c2p(l[o.direction]);n[e]={from:Math.min(t,s),to:Math.max(t,s)}}})),n}function a(){var e=c();o.getPlaceholder().trigger("plotselected",[e]),e.xaxis&&e.yaxis&&o.getPlaceholder().trigger("selected",[{x1:e.xaxis.from,y1:e.yaxis.from,x2:e.xaxis.to,y2:e.yaxis.to}])}function u(e,o,t){return ot?t:o}function d(e){var o=e.getOptions();return"smart"===o.selection.mode?t.currentMode:o.selection.mode}function f(e,i){var l=o.getPlaceholder().offset(),s=o.getPlotOffset();e.x=u(0,i.pageX-l.left-s.left,o.width()),e.y=u(0,i.pageY-l.top-s.top,o.height()),e!==t.first&&function(e){if(t.first){var o={x:e.x-t.first.x,y:e.y-t.first.y};Math.abs(o.x)l){var a=i;i=l,l=a}return{from:i,to:l,axis:n}}function m(){var e=o.getOptions().selection.minSize;return Math.abs(t.second.x-t.first.x)>=e&&Math.abs(t.second.y-t.first.y)>=e}o.clearSelection=g,o.setSelection=function(e,n){var i;"y"===d(o)?(t.first.x=0,t.second.x=o.width()):(i=x(e,"x"),t.first.x=i.axis.p2c(i.from),t.second.x=i.axis.p2c(i.to)),"x"===d(o)?(t.first.y=0,t.second.y=o.height()):(i=x(e,"y"),t.first.y=i.axis.p2c(i.from),t.second.y=i.axis.p2c(i.to)),t.show=!0,o.triggerRedrawOverlay(),!n&&m()&&a()},o.getSelection=c,o.hooks.bindEvents.push((function(e,o){null!=e.getOptions().selection.mode&&(o.mousemove(s),o.mousedown(r))})),o.hooks.drawOverlay.push((function(o,n){if(t.show&&m()){var i=o.getPlotOffset(),l=o.getOptions();n.save(),n.translate(i.left,i.top);var s=e.color.parse(l.selection.color),r=l.selection.visualization,c=1;"fill"===r&&(c=.8),n.strokeStyle=s.scale("a",c).toString(),n.lineWidth=1,n.lineJoin=l.selection.shape,n.fillStyle=s.scale("a",.4).toString();var a=Math.min(t.first.x,t.second.x)+.5,u=a,f=Math.min(t.first.y,t.second.y)+.5,h=f,g=Math.abs(t.second.x-t.first.x)-1,x=Math.abs(t.second.y-t.first.y)-1;"x"===d(o)&&(x+=f,f=0),"y"===d(o)&&(g+=a,a=0),"fill"===r?(n.fillRect(a,f,g,x),n.strokeRect(a,f,g,x)):(n.fillRect(0,0,o.width(),o.height()),n.clearRect(a,f,g,x),function(e,o,t,n,i,l,s,r){var c=Math.max(0,Math.min(15,n/2-2,i/2-2));e.fillStyle="#ffffff","xy"===r&&(e.beginPath(),e.moveTo(o,t+c),e.lineTo(o-3,t+c),e.lineTo(o-3,t-3),e.lineTo(o+c,t-3),e.lineTo(o+c,t),e.lineTo(o,t),e.closePath(),e.moveTo(o,t+i-c),e.lineTo(o-3,t+i-c),e.lineTo(o-3,t+i+3),e.lineTo(o+c,t+i+3),e.lineTo(o+c,t+i),e.lineTo(o,t+i),e.closePath(),e.moveTo(o+n,t+c),e.lineTo(o+n+3,t+c),e.lineTo(o+n+3,t-3),e.lineTo(o+n-c,t-3),e.lineTo(o+n-c,t),e.lineTo(o+n,t),e.closePath(),e.moveTo(o+n,t+i-c),e.lineTo(o+n+3,t+i-c),e.lineTo(o+n+3,t+i+3),e.lineTo(o+n-c,t+i+3),e.lineTo(o+n-c,t+i),e.lineTo(o+n,t+i),e.closePath(),e.stroke(),e.fill()),o=l,t=s,"x"===r&&(e.beginPath(),e.moveTo(o,t+15),e.lineTo(o,t-15),e.lineTo(o-3,t-15),e.lineTo(o-3,t+15),e.closePath(),e.moveTo(o+n,t+15),e.lineTo(o+n,t-15),e.lineTo(o+n+3,t-15),e.lineTo(o+n+3,t+15),e.closePath(),e.stroke(),e.fill()),"y"===r&&(e.beginPath(),e.moveTo(o-15,t),e.lineTo(o+15,t),e.lineTo(o+15,t-3),e.lineTo(o-15,t-3),e.closePath(),e.moveTo(o-15,t+i),e.lineTo(o+15,t+i),e.lineTo(o+15,t+i+3),e.lineTo(o-15,t+i+3),e.closePath(),e.stroke(),e.fill())}(n,a,f,g,x,u,h,d(o))),n.restore()}})),o.hooks.shutdown.push((function(o,t){t.unbind("mousemove",s),t.unbind("mousedown",r),l&&e(document).unbind("mouseup",l)}))},options:{selection:{mode:null,visualization:"focus",color:"#888888",shape:"round",minSize:5}},name:"selection",version:"1.1"})}(jQuery); +!function(e){e.plot.plugins.push({init:function(t){var o={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,currentMode:"xy",active:!1},n=e.plot.uiConstants.SNAPPING_CONSTANT,i={};function r(e){o.active&&(g(e),t.getPlaceholder().trigger("plotselecting",[a()]))}function l(e){var n=t.getOptions();1===e.which&&null!==n.selection.mode&&(o.currentMode="xy",document.body.focus(),void 0!==document.onselectstart&&null==i.onselectstart&&(i.onselectstart=document.onselectstart,document.onselectstart=function(){return!1}),void 0!==document.ondrag&&null==i.ondrag&&(i.ondrag=document.ondrag,document.ondrag=function(){return!1}),u(o.first,e),o.active=!0)}function s(e){return void 0!==document.onselectstart&&(document.onselectstart=i.onselectstart),void 0!==document.ondrag&&(document.ondrag=i.ondrag),o.active=!1,g(e),y()?c():(t.getPlaceholder().trigger("plotunselected",[]),t.getPlaceholder().trigger("plotselecting",[null])),!1}function a(){if(!y())return null;if(!o.show)return null;var n={},i={x:o.first.x,y:o.first.y},r={x:o.second.x,y:o.second.y};return"x"===f(t)&&(i.y=0,r.y=t.height()),"y"===f(t)&&(i.x=0,r.x=t.width()),e.each(t.getAxes(),(function(e,t){if(t.used){var o=t.c2p(i[t.direction]),l=t.c2p(r[t.direction]);n[e]={from:Math.min(o,l),to:Math.max(o,l)}}})),n}function c(){var e=a();t.getPlaceholder().trigger("plotselected",[e]),e.xaxis&&e.yaxis&&t.getPlaceholder().trigger("selected",[{x1:e.xaxis.from,y1:e.yaxis.from,x2:e.xaxis.to,y2:e.yaxis.to}])}function d(e,t,o){return to?o:t}function f(e){var t=e.getOptions();return"smart"===t.selection.mode?o.currentMode:t.selection.mode}function u(e,i){var r=t.getPlaceholder().offset(),l=t.getPlotOffset();e.x=d(0,i.pageX-r.left-l.left,t.width()),e.y=d(0,i.pageY-r.top-l.top,t.height()),e!==o.first&&function(e){if(o.first){var t={x:e.x-o.first.x,y:e.y-o.first.y};Math.abs(t.x)r){var c=i;i=r,r=c}return{from:i,to:r,axis:n}}function y(){var e=t.getOptions().selection.minSize;return Math.abs(o.second.x-o.first.x)>=e&&Math.abs(o.second.y-o.first.y)>=e}t.clearSelection=h,t.setSelection=function(e,n){var i;"y"===f(t)?(o.first.x=0,o.second.x=t.width()):(i=x(e,"x"),o.first.x=i.axis.p2c(i.from),o.second.x=i.axis.p2c(i.to)),"x"===f(t)?(o.first.y=0,o.second.y=t.height()):(i=x(e,"y"),o.first.y=i.axis.p2c(i.from),o.second.y=i.axis.p2c(i.to)),o.show=!0,t.triggerRedrawOverlay(),!n&&y()&&c()},t.getSelection=a,t.hooks.bindEvents.push((function(e,t){null!=e.getOptions().selection.mode&&(e.addEventHandler("dragstart",l,t,0),e.addEventHandler("drag",r,t,0),e.addEventHandler("dragend",s,t,0))})),t.hooks.drawOverlay.push((function(t,n){if(o.show&&y()){var i=t.getPlotOffset(),r=t.getOptions();n.save(),n.translate(i.left,i.top);var l=e.color.parse(r.selection.color),s=r.selection.visualization,a=r.selection.displaySelectionDecorations,c=1;"fill"===s&&(c=.8),n.strokeStyle=l.scale("a",c).toString(),n.lineWidth=1,n.lineJoin=r.selection.shape,n.fillStyle=l.scale("a",.4).toString();var d=Math.min(o.first.x,o.second.x)+.5,u=d,g=Math.min(o.first.y,o.second.y)+.5,h=g,x=Math.abs(o.second.x-o.first.x)-1,v=Math.abs(o.second.y-o.first.y)-1;"x"===f(t)&&(v+=g,g=0),"y"===f(t)&&(x+=d,d=0),"fill"===s?(n.fillRect(d,g,x,v),n.strokeRect(d,g,x,v)):(n.fillRect(0,0,t.width(),t.height()),n.clearRect(d,g,x,v),a&&function(e,t,o,n,i,r,l,s){var a=Math.max(0,Math.min(15,n/2-2,i/2-2));e.fillStyle="#ffffff","xy"===s&&(e.beginPath(),e.moveTo(t,o+a),e.lineTo(t-3,o+a),e.lineTo(t-3,o-3),e.lineTo(t+a,o-3),e.lineTo(t+a,o),e.lineTo(t,o),e.closePath(),e.moveTo(t,o+i-a),e.lineTo(t-3,o+i-a),e.lineTo(t-3,o+i+3),e.lineTo(t+a,o+i+3),e.lineTo(t+a,o+i),e.lineTo(t,o+i),e.closePath(),e.moveTo(t+n,o+a),e.lineTo(t+n+3,o+a),e.lineTo(t+n+3,o-3),e.lineTo(t+n-a,o-3),e.lineTo(t+n-a,o),e.lineTo(t+n,o),e.closePath(),e.moveTo(t+n,o+i-a),e.lineTo(t+n+3,o+i-a),e.lineTo(t+n+3,o+i+3),e.lineTo(t+n-a,o+i+3),e.lineTo(t+n-a,o+i),e.lineTo(t+n,o+i),e.closePath(),e.stroke(),e.fill()),t=r,o=l,"x"===s&&(e.beginPath(),e.moveTo(t,o+15),e.lineTo(t,o-15),e.lineTo(t-3,o-15),e.lineTo(t-3,o+15),e.closePath(),e.moveTo(t+n,o+15),e.lineTo(t+n,o-15),e.lineTo(t+n+3,o-15),e.lineTo(t+n+3,o+15),e.closePath(),e.stroke(),e.fill()),"y"===s&&(e.beginPath(),e.moveTo(t-15,o),e.lineTo(t+15,o),e.lineTo(t+15,o-3),e.lineTo(t-15,o-3),e.closePath(),e.moveTo(t-15,o+i),e.lineTo(t+15,o+i),e.lineTo(t+15,o+i+3),e.lineTo(t-15,o+i+3),e.closePath(),e.stroke(),e.fill())}(n,d,g,x,v,u,h,f(t))),n.restore()}})),t.hooks.shutdown.push((function(e,t){t.unbind("dragstart",l),t.unbind("drag",r),t.unbind("dragend",s)}))},options:{selection:{mode:null,visualization:"focus",displaySelectionDecorations:!0,color:"#888888",shape:"round",minSize:5}},name:"selection",version:"1.1"})}(jQuery); diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.stack.js --- a/src/myams/resources/js/ext/flot/jquery.flot.stack.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.stack.js Fri Dec 11 11:45:23 2020 +0100 @@ -78,7 +78,7 @@ if (s.stack == null || s.stack === false) return; var needsBottom = s.bars.show || (s.lines.show && s.lines.fill); - var hasBottom = datapoints.pointsize > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y); + var hasBottom = datapoints.pointsize > 2 && (s.bars.horizontal ? datapoints.format[2].x : datapoints.format[2].y); // Series data is missing bottom points - need to format if (needsBottom && !hasBottom) { addBottomPoints(s, datapoints); diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.stack.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.stack.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.stack.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -jQuery.plot.plugins.push({init:function(s){s.hooks.processDatapoints.push((function(s,n,t){if(null!=n.stack&&!1!==n.stack){var i=n.bars.show||n.lines.show&&n.lines.fill,o=t.pointsize>2&&(y?t.format[2].x:t.format[2].y);i&&!o&&function(s,n){for(var t=[],i=0;i=k.length);){if(h=z.length,null==k[j]){for(c=0;c=v.length){if(!d)for(c=0;ca){if(d&&j>0&&null!=k[j-g]){for(p=u+(k[j-g+D]-u)*(a-l)/(k[j-g+x]-l),z.push(a),z.push(p+f),c=2;c0&&null!=v[q-m]&&(r=f+(v[q-m+D]-f)*(l-a)/(v[q-m+x]-a)),z[h+D]+=r,j+=g}w=!1,h!==z.length&&i&&(z[h+2]+=r)}if(b&&h!==z.length&&h>0&&null!==z[h]&&z[h]!==z[h-g]&&z[h+1]!==z[h-g+1]){for(c=0;c2&&(n.bars.horizontal?o.format[2].x:o.format[2].y);t&&!i&&function(s,n){for(var o=[],t=0;t=k.length);){if(h=z.length,null==k[j]){for(c=0;c=v.length){if(!b)for(c=0;ca){if(b&&j>0&&null!=k[j-g]){for(p=u+(k[j-g+D]-u)*(a-l)/(k[j-g+x]-l),z.push(a),z.push(p+r),c=2;c0&&null!=v[q-m]&&(f=r+(v[q-m+D]-r)*(l-a)/(v[q-m+x]-a)),z[h+D]+=f,j+=g}w=!1,h!==z.length&&t&&(z[h+2]+=f)}if(y&&h!==z.length&&h>0&&null!==z[h]&&z[h]!==z[h-g]&&z[h+1]!==z[h-g+1]){for(c=0;c 0) { - var magnitude = parseFloat('1e' + (dec-6)); - n = Math.round(Math.round(n*magnitude)/magnitude); - n = ('00000' + n).slice(-6,-(6 - dec)); - } else { - n = Math.round(n) - n = ('00000' + n).slice(-6); - } - return n; - }; + var formatSubSeconds = function(milliseconds, microseconds, numberDecimalPlaces) { + var totalMicroseconds = milliseconds * 1000 + microseconds; + var formattedString; + if (numberDecimalPlaces < 6 && numberDecimalPlaces > 0) { + var magnitude = parseFloat('1e' + (numberDecimalPlaces - 6)); + totalMicroseconds = Math.round(Math.round(totalMicroseconds * magnitude) / magnitude); + formattedString = ('00000' + totalMicroseconds).slice(-6, -(6 - numberDecimalPlaces)); + } else { + totalMicroseconds = Math.round(totalMicroseconds) + formattedString = ('00000' + totalMicroseconds).slice(-6); + } + return formattedString; + }; var r = []; var escape = false; var hours = d.getHours(); - var isAM = hours < 12; + var isAM = hours < 12; if (!monthNames) { monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; @@ -112,55 +112,55 @@ } var hours12; - if (hours > 12) { - hours12 = hours - 12; - } else if (hours == 0) { - hours12 = 12; - } else { - hours12 = hours; - } + if (hours > 12) { + hours12 = hours - 12; + } else if (hours === 0) { + hours12 = 12; + } else { + hours12 = hours; + } var decimals = -1; for (var i = 0; i < fmt.length; ++i) { - var c = fmt.charAt(i); + var c = fmt.charAt(i); if (!isNaN(Number(c)) && Number(c) > 0) { decimals = Number(c); } else if (escape) { - switch (c) { - case 'a': c = "" + dayNames[d.getDay()]; break; - case 'b': c = "" + monthNames[d.getMonth()]; break; - case 'd': c = leftPad(d.getDate()); break; - case 'e': c = leftPad(d.getDate(), " "); break; - case 'h': // For back-compat with 0.7; remove in 1.0 - case 'H': c = leftPad(hours); break; - case 'I': c = leftPad(hours12); break; - case 'l': c = leftPad(hours12, " "); break; - case 'm': c = leftPad(d.getMonth() + 1); break; - case 'M': c = leftPad(d.getMinutes()); break; - // quarters not in Open Group's strftime specification - case 'q': - c = "" + (Math.floor(d.getMonth() / 3) + 1); break; - case 'S': c = leftPad(d.getSeconds()); break; - case 's': c = "" + formatMicroseconds(d.getMicroseconds(),decimals); break; - case 'y': c = leftPad(d.getFullYear() % 100); break; - case 'Y': c = "" + d.getFullYear(); break; - case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break; - case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break; - case 'w': c = "" + d.getDay(); break; - } - r.push(c); - escape = false; - } else { - if (c == "%") { - escape = true; - } else { - r.push(c); - } - } - } + switch (c) { + case 'a': c = "" + dayNames[d.getDay()]; break; + case 'b': c = "" + monthNames[d.getMonth()]; break; + case 'd': c = leftPad(d.getDate()); break; + case 'e': c = leftPad(d.getDate(), " "); break; + case 'h': // For back-compat with 0.7; remove in 1.0 + case 'H': c = leftPad(hours); break; + case 'I': c = leftPad(hours12); break; + case 'l': c = leftPad(hours12, " "); break; + case 'm': c = leftPad(d.getMonth() + 1); break; + case 'M': c = leftPad(d.getMinutes()); break; + // quarters not in Open Group's strftime specification + case 'q': + c = "" + (Math.floor(d.getMonth() / 3) + 1); break; + case 'S': c = leftPad(d.getSeconds()); break; + case 's': c = "" + formatSubSeconds(d.getMilliseconds(), d.getMicroseconds(), decimals); break; + case 'y': c = leftPad(d.getFullYear() % 100); break; + case 'Y': c = "" + d.getFullYear(); break; + case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break; + case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break; + case 'w': c = "" + d.getDay(); break; + } + r.push(c); + escape = false; + } else { + if (c === "%") { + escape = true; + } else { + r.push(c); + } + } + } - return r.join(""); + return r.join(""); } // To have a consistent view of time-based data independent of which time @@ -296,7 +296,6 @@ var specQuarters = baseSpec.concat([[1, "quarter"], [2, "quarter"], [1, "year"]]); - function dateTickGenerator(axis) { var opts = axis.options, ticks = [], @@ -399,7 +398,7 @@ if (step >= timeUnitSize.second) { d.setMicroseconds(0); } else { - d.setMicroseconds(d.getMilliseconds()*1000); + d.setMicroseconds(d.getMilliseconds() * 1000); } } if (step >= timeUnitSize.minute) { @@ -482,20 +481,23 @@ if (opts.mode === "time") { axis.tickGenerator = dateTickGenerator; + // if a tick formatter is already provided do not overwrite it + if ('tickFormatter' in opts && typeof opts.tickFormatter === 'function') return; + axis.tickFormatter = function (v, axis) { var d = dateGenerator(v, axis.options); // first check global format - if (opts.timeformat != null) { - return formatDate(d, opts.timeformat, opts.monthNames, opts.dayNames); - } + if (opts.timeformat != null) { + return formatDate(d, opts.timeformat, opts.monthNames, opts.dayNames); + } - // possibly use quarters if quarters are mentioned in - // any of these places - var useQuarters = (axis.options.tickSize && - axis.options.tickSize[1] == "quarter") || - (axis.options.minTickSize && - axis.options.minTickSize[1] == "quarter"); + // possibly use quarters if quarters are mentioned in + // any of these places + var useQuarters = (axis.options.tickSize && + axis.options.tickSize[1] === "quarter") || + (axis.options.minTickSize && + axis.options.minTickSize[1] === "quarter"); var timeUnitSize; if (opts.timeBase === 'seconds') { @@ -506,12 +508,12 @@ timeUnitSize = timeUnitSizeMilliseconds; } - var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]]; - var span = axis.max - axis.min; - var suffix = (opts.twelveHourClock) ? " %p" : ""; - var hourCode = (opts.twelveHourClock) ? "%I" : "%H"; + var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]]; + var span = axis.max - axis.min; + var suffix = (opts.twelveHourClock) ? " %p" : ""; + var hourCode = (opts.twelveHourClock) ? "%I" : "%H"; var factor; - var fmt; + var fmt; if (opts.timeBase === 'seconds') { factor = 1; @@ -522,45 +524,45 @@ } if (t < timeUnitSize.second) { - var decimals = -Math.floor(Math.log10(t/factor)) + var decimals = -Math.floor(Math.log10(t / factor)) // the two-and-halves require an additional decimal if (String(t).indexOf('25') > -1) { decimals++; } - fmt = "%S.%" + decimals + "s"; + fmt = "%S.%" + decimals + "s"; } else if (t < timeUnitSize.minute) { - fmt = hourCode + ":%M:%S" + suffix; - } else if (t < timeUnitSize.day) { - if (span < 2 * timeUnitSize.day) { - fmt = hourCode + ":%M" + suffix; - } else { - fmt = "%b %d " + hourCode + ":%M" + suffix; - } - } else if (t < timeUnitSize.month) { - fmt = "%b %d"; - } else if ((useQuarters && t < timeUnitSize.quarter) || - (!useQuarters && t < timeUnitSize.year)) { - if (span < timeUnitSize.year) { - fmt = "%b"; - } else { - fmt = "%b %Y"; - } - } else if (useQuarters && t < timeUnitSize.year) { - if (span < timeUnitSize.year) { - fmt = "Q%q"; - } else { - fmt = "Q%q %Y"; - } - } else { - fmt = "%Y"; - } + fmt = hourCode + ":%M:%S" + suffix; + } else if (t < timeUnitSize.day) { + if (span < 2 * timeUnitSize.day) { + fmt = hourCode + ":%M" + suffix; + } else { + fmt = "%b %d " + hourCode + ":%M" + suffix; + } + } else if (t < timeUnitSize.month) { + fmt = "%b %d"; + } else if ((useQuarters && t < timeUnitSize.quarter) || + (!useQuarters && t < timeUnitSize.year)) { + if (span < timeUnitSize.year) { + fmt = "%b"; + } else { + fmt = "%b %Y"; + } + } else if (useQuarters && t < timeUnitSize.year) { + if (span < timeUnitSize.year) { + fmt = "Q%q"; + } else { + fmt = "Q%q %Y"; + } + } else { + fmt = "%Y"; + } - var rt = formatDate(d, fmt, opts.monthNames, opts.dayNames); + var rt = formatDate(d, fmt, opts.monthNames, opts.dayNames); - return rt; + return rt; }; } }); diff -r 41732eb0701a -r f695c11dcd2d src/myams/resources/js/ext/flot/jquery.flot.time.min.js --- a/src/myams/resources/js/ext/flot/jquery.flot.time.min.js Fri Dec 11 08:52:58 2020 +0100 +++ b/src/myams/resources/js/ext/flot/jquery.flot.time.min.js Fri Dec 11 11:45:23 2020 +0100 @@ -1,1 +1,1 @@ -!function(e){"use strict";var t=e.plot.saturated.floorInBase,i=function(e,t){var i=new e(t),o=i.setTime.bind(i);i.update=function(e){o(e);var t=(e=Math.round(1e3*e)/1e3)/1e3;this.microseconds=1e6*(t-Math.floor(t))};var n=i.getTime.bind(i);return i.getTime=function(){return n()+this.microseconds/1e3},i.setTime=function(e){this.update(e)},i.getMicroseconds=function(){return this.microseconds},i.setMicroseconds=function(e){var t=n()+e/1e3;this.update(t)},i.setUTCMicroseconds=function(e){this.setMicroseconds(e)},i.getUTCMicroseconds=function(){return this.getMicroseconds()},i.microseconds=null,i.microEpoch=null,i.update(t),i};function o(e,t,i,o){if("function"==typeof e.strftime)return e.strftime(t);var n,s=function(e,t){return t=""+(null==t?"0":t),1==(e=""+e).length?t+e:e},r=function(e,t){if(t<6&&t>0){var i=parseFloat("1e"+(t-6));e=("00000"+(e=Math.round(Math.round(e*i)/i))).slice(-6,-(6-t))}else e=("00000"+(e=Math.round(e))).slice(-6);return e},a=[],c=!1,m=e.getHours(),u=m<12;i||(i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),o||(o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]),n=m>12?m-12:0==m?12:m;for(var d=-1,l=0;l0)d=Number(h);else if(c){switch(h){case"a":h=""+o[e.getDay()];break;case"b":h=""+i[e.getMonth()];break;case"d":h=s(e.getDate());break;case"e":h=s(e.getDate()," ");break;case"h":case"H":h=s(m);break;case"I":h=s(n);break;case"l":h=s(n," ");break;case"m":h=s(e.getMonth()+1);break;case"M":h=s(e.getMinutes());break;case"q":h=""+(Math.floor(e.getMonth()/3)+1);break;case"S":h=s(e.getSeconds());break;case"s":h=""+r(e.getMicroseconds(),d);break;case"y":h=s(e.getFullYear()%100);break;case"Y":h=""+e.getFullYear();break;case"p":h=u?"am":"pm";break;case"P":h=u?"AM":"PM";break;case"w":h=""+e.getDay()}a.push(h),c=!1}else"%"==h?c=!0:a.push(h)}return a.join("")}function n(e){function t(e,t,i,o){e[t]=function(){return i[o].apply(i,arguments)}}var i={date:e};void 0!==e.strftime&&t(i,"strftime",e,"strftime"),t(i,"getTime",e,"getTime"),t(i,"setTime",e,"setTime");for(var o=["Date","Day","FullYear","Hours","Minutes","Month","Seconds","Milliseconds","Microseconds"],n=0;n864e13?e=864e13:e<-864e13&&(e=-864e13),"browser"===t.timezone)return i(Date,e);if(t.timezone&&"utc"!==t.timezone){if("undefined"!=typeof timezoneJS&&void 0!==timezoneJS.Date){var o=i(timezoneJS.Date,e);return o.setTimezone(t.timezone),o.setTime(e),o}return n(i(Date,e))}return n(i(Date,e))}var r={microsecond:1e-6,millisecond:.001,second:1,minute:60,hour:3600,day:86400,month:2592e3,quarter:7776e3,year:525949.2*60},a={microsecond:.001,millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,quarter:7776e6,year:525949.2*60*1e3},c={microsecond:1,millisecond:1e3,second:1e6,minute:6e7,hour:36e8,day:864e8,month:2592e9,quarter:7776e9,year:525949.2*60*1e6},m=[[1,"microsecond"],[2,"microsecond"],[5,"microsecond"],[10,"microsecond"],[25,"microsecond"],[50,"microsecond"],[100,"microsecond"],[250,"microsecond"],[500,"microsecond"],[1,"millisecond"],[2,"millisecond"],[5,"millisecond"],[10,"millisecond"],[25,"millisecond"],[50,"millisecond"],[100,"millisecond"],[250,"millisecond"],[500,"millisecond"],[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"]],u=m.concat([[3,"month"],[6,"month"],[1,"year"]]),d=m.concat([[1,"quarter"],[2,"quarter"],[1,"year"]]);function l(e){var i,o=e.options,n=[],m=s(e.min,o),l=0,h=o.tickSize&&"quarter"===o.tickSize[1]||o.minTickSize&&"quarter"===o.minTickSize[1]?d:u;i="seconds"===o.timeBase?r:"microseconds"===o.timeBase?c:a,null!==o.minTickSize&&void 0!==o.minTickSize&&(l="number"==typeof o.tickSize?o.tickSize:o.minTickSize[0]*i[o.minTickSize[1]]);for(var M=0;M=l);++M);var f=h[M][0],g=h[M][1];if("year"===g){if(null!==o.minTickSize&&void 0!==o.minTickSize&&"year"===o.minTickSize[1])f=Math.floor(o.minTickSize[0]);else{var k=parseFloat("1e"+Math.floor(Math.log(e.delta/i.year)/Math.LN10)),p=e.delta/i.year/k;f=p<1.5?1:p<3?2:p<7.5?5:10,f*=k}f<1&&(f=1)}e.tickSize=o.tickSize||[f,g];var y=e.tickSize[0],S=y*i[g=e.tickSize[1]];"microsecond"===g?m.setMicroseconds(t(m.getMicroseconds(),y)):"millisecond"===g?m.setMilliseconds(t(m.getMilliseconds(),y)):"second"===g?m.setSeconds(t(m.getSeconds(),y)):"minute"===g?m.setMinutes(t(m.getMinutes(),y)):"hour"===g?m.setHours(t(m.getHours(),y)):"month"===g?m.setMonth(t(m.getMonth(),y)):"quarter"===g?m.setMonth(3*t(m.getMonth()/3,y)):"year"===g&&m.setFullYear(t(m.getFullYear(),y)),S>=i.millisecond&&(S>=i.second?m.setMicroseconds(0):m.setMicroseconds(1e3*m.getMilliseconds())),S>=i.minute&&m.setSeconds(0),S>=i.hour&&m.setMinutes(0),S>=i.day&&m.setHours(0),S>=4*i.day&&m.setDate(1),S>=2*i.month&&m.setMonth(t(m.getMonth(),3)),S>=2*i.quarter&&m.setMonth(t(m.getMonth(),6)),S>=i.year&&m.setMonth(0);var T,v,z=0,b=Number.NaN;do{if(v=b,T=m.getTime(),b=o&&"seconds"===o.timeBase?T/1e3:o&&"microseconds"===o.timeBase?1e3*T:T,n.push(b),"month"===g||"quarter"===g)if(y<1){m.setDate(1);var q=m.getTime();m.setMonth(m.getMonth()+("quarter"===g?3:1));var B=m.getTime();m.setTime(b+z*i.hour+(B-q)*y),z=m.getHours(),m.setHours(0)}else m.setMonth(m.getMonth()+y*("quarter"===g?3:1));else"year"===g?m.setFullYear(m.getFullYear()+y):"seconds"===o.timeBase?m.setTime(1e3*(b+S)):"microseconds"===o.timeBase?m.setTime((b+S)/1e3):m.setTime(b+S)}while(b-1&&k++,l="%S.%"+k+"s"}else l=h0){var s=parseFloat("1e"+(i-6));o=("00000"+(n=Math.round(Math.round(n*s)/s))).slice(-6,-(6-i))}else o=("00000"+(n=Math.round(n))).slice(-6);return o},c=[],a=!1,m=e.getHours(),u=m<12;i||(i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),o||(o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]),n=m>12?m-12:0===m?12:m;for(var d=-1,l=0;l0)d=Number(h);else if(a){switch(h){case"a":h=""+o[e.getDay()];break;case"b":h=""+i[e.getMonth()];break;case"d":h=s(e.getDate());break;case"e":h=s(e.getDate()," ");break;case"h":case"H":h=s(m);break;case"I":h=s(n);break;case"l":h=s(n," ");break;case"m":h=s(e.getMonth()+1);break;case"M":h=s(e.getMinutes());break;case"q":h=""+(Math.floor(e.getMonth()/3)+1);break;case"S":h=s(e.getSeconds());break;case"s":h=""+r(e.getMilliseconds(),e.getMicroseconds(),d);break;case"y":h=s(e.getFullYear()%100);break;case"Y":h=""+e.getFullYear();break;case"p":h=u?"am":"pm";break;case"P":h=u?"AM":"PM";break;case"w":h=""+e.getDay()}c.push(h),a=!1}else"%"===h?a=!0:c.push(h)}return c.join("")}function n(e){function t(e,t,i,o){e[t]=function(){return i[o].apply(i,arguments)}}var i={date:e};void 0!==e.strftime&&t(i,"strftime",e,"strftime"),t(i,"getTime",e,"getTime"),t(i,"setTime",e,"setTime");for(var o=["Date","Day","FullYear","Hours","Minutes","Month","Seconds","Milliseconds","Microseconds"],n=0;n864e13?e=864e13:e<-864e13&&(e=-864e13),"browser"===t.timezone)return i(Date,e);if(t.timezone&&"utc"!==t.timezone){if("undefined"!=typeof timezoneJS&&void 0!==timezoneJS.Date){var o=i(timezoneJS.Date,e);return o.setTimezone(t.timezone),o.setTime(e),o}return n(i(Date,e))}return n(i(Date,e))}var r={microsecond:1e-6,millisecond:.001,second:1,minute:60,hour:3600,day:86400,month:2592e3,quarter:7776e3,year:525949.2*60},c={microsecond:.001,millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,quarter:7776e6,year:525949.2*60*1e3},a={microsecond:1,millisecond:1e3,second:1e6,minute:6e7,hour:36e8,day:864e8,month:2592e9,quarter:7776e9,year:525949.2*60*1e6},m=[[1,"microsecond"],[2,"microsecond"],[5,"microsecond"],[10,"microsecond"],[25,"microsecond"],[50,"microsecond"],[100,"microsecond"],[250,"microsecond"],[500,"microsecond"],[1,"millisecond"],[2,"millisecond"],[5,"millisecond"],[10,"millisecond"],[25,"millisecond"],[50,"millisecond"],[100,"millisecond"],[250,"millisecond"],[500,"millisecond"],[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"]],u=m.concat([[3,"month"],[6,"month"],[1,"year"]]),d=m.concat([[1,"quarter"],[2,"quarter"],[1,"year"]]);function l(e){var i,o=e.options,n=[],m=s(e.min,o),l=0,h=o.tickSize&&"quarter"===o.tickSize[1]||o.minTickSize&&"quarter"===o.minTickSize[1]?d:u;i="seconds"===o.timeBase?r:"microseconds"===o.timeBase?a:c,null!==o.minTickSize&&void 0!==o.minTickSize&&(l="number"==typeof o.tickSize?o.tickSize:o.minTickSize[0]*i[o.minTickSize[1]]);for(var f=0;f=l);++f);var M=h[f][0],g=h[f][1];if("year"===g){if(null!==o.minTickSize&&void 0!==o.minTickSize&&"year"===o.minTickSize[1])M=Math.floor(o.minTickSize[0]);else{var k=parseFloat("1e"+Math.floor(Math.log(e.delta/i.year)/Math.LN10)),p=e.delta/i.year/k;M=p<1.5?1:p<3?2:p<7.5?5:10,M*=k}M<1&&(M=1)}e.tickSize=o.tickSize||[M,g];var y=e.tickSize[0],S=y*i[g=e.tickSize[1]];"microsecond"===g?m.setMicroseconds(t(m.getMicroseconds(),y)):"millisecond"===g?m.setMilliseconds(t(m.getMilliseconds(),y)):"second"===g?m.setSeconds(t(m.getSeconds(),y)):"minute"===g?m.setMinutes(t(m.getMinutes(),y)):"hour"===g?m.setHours(t(m.getHours(),y)):"month"===g?m.setMonth(t(m.getMonth(),y)):"quarter"===g?m.setMonth(3*t(m.getMonth()/3,y)):"year"===g&&m.setFullYear(t(m.getFullYear(),y)),S>=i.millisecond&&(S>=i.second?m.setMicroseconds(0):m.setMicroseconds(1e3*m.getMilliseconds())),S>=i.minute&&m.setSeconds(0),S>=i.hour&&m.setMinutes(0),S>=i.day&&m.setHours(0),S>=4*i.day&&m.setDate(1),S>=2*i.month&&m.setMonth(t(m.getMonth(),3)),S>=2*i.quarter&&m.setMonth(t(m.getMonth(),6)),S>=i.year&&m.setMonth(0);var T,v,z=0,b=Number.NaN;do{if(v=b,T=m.getTime(),b=o&&"seconds"===o.timeBase?T/1e3:o&&"microseconds"===o.timeBase?1e3*T:T,n.push(b),"month"===g||"quarter"===g)if(y<1){m.setDate(1);var q=m.getTime();m.setMonth(m.getMonth()+("quarter"===g?3:1));var B=m.getTime();m.setTime(b+z*i.hour+(B-q)*y),z=m.getHours(),m.setHours(0)}else m.setMonth(m.getMonth()+y*("quarter"===g?3:1));else"year"===g?m.setFullYear(m.getFullYear()+y):"seconds"===o.timeBase?m.setTime(1e3*(b+S)):"microseconds"===o.timeBase?m.setTime((b+S)/1e3):m.setTime(b+S)}while(b-1&&k++,l="%S.%"+k+"s"}else l=h