12 |
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.line_heatmap=e():t.line_heatmap=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=4)}([function(t,e,r){"use strict";r.d(e,"a",function(){return o});var n=r(3),i=r.n(n);function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ID=e,this.heatmap=null}var e,r,n;return e=t,(r=[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={container:document.getElementById(this.ID)};e=Object.assign(e,t),this.heatmap=i.a.create(e),console.log(this.heatmap)}},{key:"setTrackData",value:function(t){var e=this;this.heatmap.setData({max:0,min:0,data:[]}),t.forEach(function(t){e.heatmap.addData(t)})}}])&&a(e.prototype,r),n&&a(e,n),t}()},function(t,e,r){"use strict";(function(t){var n=r(0),i=(r(2),'<div>\n <div class="line-heatmap-controls">\n <div id="line-heatmap-slider"></div>\n </div>\n <div id="line-heatmap-canvas">\n </div>\n</div>\n'),a={};function o(t){return t.split("\n").filter(function(t){return t.split(",").length>3}).map(function(t){var e=JSON.parse("["+t+"]");return{x:e[0],y:e[1],value:1}})}e.a={init:function(e,r){var s=document.getElementById(e);s.innerHTML=i;var l=o(r),u=new n.a("line-heatmap-canvas");u.create(),u.setTrackData(l);var c=document.getElementById("line-heatmap-slider");t.create(c,{start:[1,l.length],connect:!0,margin:1,range:{min:1,max:l.length}}),a.container=s,a.heatmap=u,a.data=l,a.slider=c,c.noUiSlider.on("update",function(t,e){var r=this.get();console.log(r);var n=a.data.slice(+r[0]-1,+r[1]+1);console.log(n),a.heatmap.setTrackData(n)})},updateLogString:function(t){var e=o(t);a.data=e,a.slider.noUiSlider.updateOptions({range:{min:1,max:e.length}}),a.heatmap.setTrackData(e)}}}).call(this,r(2))},function(t,e,r){var n,i,a;/*! nouislider - 12.1.0 - 10/25/2018 */i=[],void 0===(a="function"==typeof(n=function(){"use strict";var t="12.1.0";function e(t){return null!=t}function r(t){t.preventDefault()}function n(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function i(t,e,r){r>0&&(l(t,e),setTimeout(function(){u(t,e)},r))}function a(t){return Math.max(Math.min(t,100),0)}function o(t){return Array.isArray(t)?t:[t]}function s(t){var e=(t=String(t)).split(".");return e.length>1?e[1].length:0}function l(t,e){t.classList?t.classList.add(e):t.className+=" "+e}function u(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function c(t){var e=void 0!==window.pageXOffset,r="CSS1Compat"===(t.compatMode||""),n=e?window.pageXOffset:r?t.documentElement.scrollLeft:t.body.scrollLeft,i=e?window.pageYOffset:r?t.documentElement.scrollTop:t.body.scrollTop;return{x:n,y:i}}function h(t,e){return 100/(e-t)}function d(t,e){return 100*e/(t[1]-t[0])}function f(t,e){for(var r=1;t>=e[r];)r+=1;return r}function p(t,e,r){if(r>=t.slice(-1)[0])return 100;var n=f(r,t),i=t[n-1],a=t[n],o=e[n-1],s=e[n];return o+function(t,e){return d(t,t[0]<0?e+Math.abs(t[0]):e-t[0])}([i,a],r)/h(o,s)}function m(t,e,r,n){if(100===n)return n;var i=f(n,t),a=t[i-1],o=t[i];return r?n-a>(o-a)/2?o:a:e[i-1]?t[i-1]+function(t,e){return Math.round(t/e)*e}(n-t[i-1],e[i-1]):n}function g(e,r,i){var a;if("number"==typeof r&&(r=[r]),!Array.isArray(r))throw new Error("noUiSlider ("+t+"): 'range' contains invalid value.");if(!n(a="min"===e?0:"max"===e?100:parseFloat(e))||!n(r[0]))throw new Error("noUiSlider ("+t+"): 'range' value isn't numeric.");i.xPct.push(a),i.xVal.push(r[0]),a?i.xSteps.push(!isNaN(r[1])&&r[1]):isNaN(r[1])||(i.xSteps[0]=r[1]),i.xHighestCompleteStep.push(0)}function v(t,e,r){if(!e)return!0;r.xSteps[t]=d([r.xVal[t],r.xVal[t+1]],e)/h(r.xPct[t],r.xPct[t+1]);var n=(r.xVal[t+1]-r.xVal[t])/r.xNumSteps[t],i=Math.ceil(Number(n.toFixed(3))-1),a=r.xVal[t]+r.xNumSteps[t]*i;r.xHighestCompleteStep[t]=a}function x(t,e,r){var n;this.xPct=[],this.xVal=[],this.xSteps=[r||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=e;var i=[];for(n in t)t.hasOwnProperty(n)&&i.push([t[n],n]);for(i.length&&"object"==typeof i[0][0]?i.sort(function(t,e){return t[0][0]-e[0][0]}):i.sort(function(t,e){return t[0]-e[0]}),n=0;n<i.length;n++)g(i[n][1],i[n][0],this);for(this.xNumSteps=this.xSteps.slice(0),n=0;n<this.xNumSteps.length;n++)v(n,this.xNumSteps[n],this)}x.prototype.getMargin=function(e){var r=this.xNumSteps[0];if(r&&e/r%1!=0)throw new Error("noUiSlider ("+t+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&d(this.xVal,e)},x.prototype.toStepping=function(t){return t=p(this.xVal,this.xPct,t)},x.prototype.fromStepping=function(t){return function(t,e,r){if(r>=100)return t.slice(-1)[0];var n=f(r,e),i=t[n-1],a=t[n],o=e[n-1],s=e[n];return function(t,e){return e*(t[1]-t[0])/100+t[0]}([i,a],(r-o)*h(o,s))}(this.xVal,this.xPct,t)},x.prototype.getStep=function(t){return t=m(this.xPct,this.xSteps,this.snap,t)},x.prototype.getNearbySteps=function(t){var e=f(t,this.xPct);return{stepBefore:{startValue:this.xVal[e-2],step:this.xNumSteps[e-2],highestStep:this.xHighestCompleteStep[e-2]},thisStep:{startValue:this.xVal[e-1],step:this.xNumSteps[e-1],highestStep:this.xHighestCompleteStep[e-1]},stepAfter:{startValue:this.xVal[e],step:this.xNumSteps[e],highestStep:this.xHighestCompleteStep[e]}}},x.prototype.countStepDecimals=function(){var t=this.xNumSteps.map(s);return Math.max.apply(null,t)},x.prototype.convert=function(t){return this.getStep(this.toStepping(t))};var b={to:function(t){return void 0!==t&&t.toFixed(2)},from:Number};function y(e){if(function(t){return"object"==typeof t&&"function"==typeof t.to&&"function"==typeof t.from}(e))return!0;throw new Error("noUiSlider ("+t+"): 'format' requires 'to' and 'from' methods.")}function _(e,r){if(!n(r))throw new Error("noUiSlider ("+t+"): 'step' is not numeric.");e.singleStep=r}function w(e,r){if("object"!=typeof r||Array.isArray(r))throw new Error("noUiSlider ("+t+"): 'range' is not an object.");if(void 0===r.min||void 0===r.max)throw new Error("noUiSlider ("+t+"): Missing 'min' or 'max' in 'range'.");if(r.min===r.max)throw new Error("noUiSlider ("+t+"): 'range' 'min' and 'max' cannot be equal.");e.spectrum=new x(r,e.snap,e.singleStep)}function S(e,r){if(r=o(r),!Array.isArray(r)||!r.length)throw new Error("noUiSlider ("+t+"): 'start' option is incorrect.");e.handles=r.length,e.start=r}function C(e,r){if(e.snap=r,"boolean"!=typeof r)throw new Error("noUiSlider ("+t+"): 'snap' option must be a boolean.")}function E(e,r){if(e.animate=r,"boolean"!=typeof r)throw new Error("noUiSlider ("+t+"): 'animate' option must be a boolean.")}function D(e,r){if(e.animationDuration=r,"number"!=typeof r)throw new Error("noUiSlider ("+t+"): 'animationDuration' option must be a number.")}function N(e,r){var n,i=[!1];if("lower"===r?r=[!0,!1]:"upper"===r&&(r=[!1,!0]),!0===r||!1===r){for(n=1;n<e.handles;n++)i.push(r);i.push(!1)}else{if(!Array.isArray(r)||!r.length||r.length!==e.handles+1)throw new Error("noUiSlider ("+t+"): 'connect' option doesn't match handle count.");i=r}e.connect=i}function O(e,r){switch(r){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:throw new Error("noUiSlider ("+t+"): 'orientation' option is invalid.")}}function M(e,r){if(!n(r))throw new Error("noUiSlider ("+t+"): 'margin' option must be numeric.");if(0!==r&&(e.margin=e.spectrum.getMargin(r),!e.margin))throw new Error("noUiSlider ("+t+"): 'margin' option is only supported on linear sliders.")}function U(e,r){if(!n(r))throw new Error("noUiSlider ("+t+"): 'limit' option must be numeric.");if(e.limit=e.spectrum.getMargin(r),!e.limit||e.handles<2)throw new Error("noUiSlider ("+t+"): 'limit' option is only supported on linear sliders with 2 or more handles.")}function k(e,r){if(!n(r)&&!Array.isArray(r))throw new Error("noUiSlider ("+t+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(Array.isArray(r)&&2!==r.length&&!n(r[0])&&!n(r[1]))throw new Error("noUiSlider ("+t+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(0!==r){if(Array.isArray(r)||(r=[r,r]),e.padding=[e.spectrum.getMargin(r[0]),e.spectrum.getMargin(r[1])],!1===e.padding[0]||!1===e.padding[1])throw new Error("noUiSlider ("+t+"): 'padding' option is only supported on linear sliders.");if(e.padding[0]<0||e.padding[1]<0)throw new Error("noUiSlider ("+t+"): 'padding' option must be a positive number(s).");if(e.padding[0]+e.padding[1]>=100)throw new Error("noUiSlider ("+t+"): 'padding' option must not exceed 100% of the range.")}}function P(e,r){switch(r){case"ltr":e.dir=0;break;case"rtl":e.dir=1;break;default:throw new Error("noUiSlider ("+t+"): 'direction' option was not recognized.")}}function A(e,r){if("string"!=typeof r)throw new Error("noUiSlider ("+t+"): 'behaviour' must be a string containing options.");var n=r.indexOf("tap")>=0,i=r.indexOf("drag")>=0,a=r.indexOf("fixed")>=0,o=r.indexOf("snap")>=0,s=r.indexOf("hover")>=0,l=r.indexOf("unconstrained")>=0;if(a){if(2!==e.handles)throw new Error("noUiSlider ("+t+"): 'fixed' behaviour must be used with 2 handles");M(e,e.start[1]-e.start[0])}if(l&&(e.margin||e.limit))throw new Error("noUiSlider ("+t+"): 'unconstrained' behaviour cannot be used with margin or limit");e.events={tap:n||o,drag:i,fixed:a,snap:o,hover:s,unconstrained:l}}function V(e,r){if(!1!==r)if(!0===r){e.tooltips=[];for(var n=0;n<e.handles;n++)e.tooltips.push(!0)}else{if(e.tooltips=o(r),e.tooltips.length!==e.handles)throw new Error("noUiSlider ("+t+"): must pass a formatter for all handles.");e.tooltips.forEach(function(e){if("boolean"!=typeof e&&("object"!=typeof e||"function"!=typeof e.to))throw new Error("noUiSlider ("+t+"): 'tooltips' must be passed a formatter or 'false'.")})}}function F(t,e){t.ariaFormat=e,y(e)}function j(t,e){t.format=e,y(e)}function L(e,r){if(e.keyboardSupport=r,"boolean"!=typeof r)throw new Error("noUiSlider ("+t+"): 'keyboardSupport' option must be a boolean.")}function R(t,e){t.documentElement=e}function z(e,r){if("string"!=typeof r&&!1!==r)throw new Error("noUiSlider ("+t+"): 'cssPrefix' must be a string or `false`.");e.cssPrefix=r}function B(e,r){if("object"!=typeof r)throw new Error("noUiSlider ("+t+"): 'cssClasses' must be an object.");if("string"==typeof e.cssPrefix)for(var n in e.cssClasses={},r)r.hasOwnProperty(n)&&(e.cssClasses[n]=e.cssPrefix+r[n]);else e.cssClasses=r}function T(r){var n={margin:0,limit:0,padding:0,animate:!0,animationDuration:300,ariaFormat:b,format:b},i={step:{r:!1,t:_},start:{r:!0,t:S},connect:{r:!0,t:N},direction:{r:!0,t:P},snap:{r:!1,t:C},animate:{r:!1,t:E},animationDuration:{r:!1,t:D},range:{r:!0,t:w},orientation:{r:!1,t:O},margin:{r:!1,t:M},limit:{r:!1,t:U},padding:{r:!1,t:k},behaviour:{r:!0,t:A},ariaFormat:{r:!1,t:F},format:{r:!1,t:j},tooltips:{r:!1,t:V},keyboardSupport:{r:!0,t:L},documentElement:{r:!1,t:R},cssPrefix:{r:!0,t:z},cssClasses:{r:!0,t:B}},a={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal",keyboardSupport:!0,cssPrefix:"noUi-",cssClasses:{target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"}};r.format&&!r.ariaFormat&&(r.ariaFormat=r.format),Object.keys(i).forEach(function(o){if(!e(r[o])&&void 0===a[o]){if(i[o].r)throw new Error("noUiSlider ("+t+"): '"+o+"' is required.");return!0}i[o].t(n,e(r[o])?r[o]:a[o])}),n.pips=r.pips;var o=document.createElement("div"),s=void 0!==o.style.msTransform,l=void 0!==o.style.transform;return n.transformRule=l?"transform":s?"msTransform":"webkitTransform",n.style=[["left","top"],["right","bottom"]][n.dir][n.ort],n}function H(e,n,s){var h,d,f,p,m,g,v,x,b=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"},y=window.CSS&&CSS.supports&&CSS.supports("touch-action","none"),_=y&&function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e)}catch(t){}return t}(),w=e,S=[],C=[],E=0,D=n.spectrum,N=[],O={},M=e.ownerDocument,U=n.documentElement||M.documentElement,k=M.body,P=-1,A=0,V=1,F=2,j="rtl"===M.dir||1===n.ort?0:100;function L(t,e){var r=M.createElement("div");return e&&l(r,e),t.appendChild(r),r}function R(t,e){var r=L(t,n.cssClasses.origin),i=L(r,n.cssClasses.handle);return i.setAttribute("data-handle",e),n.keyboardSupport&&i.setAttribute("tabindex","0"),i.setAttribute("role","slider"),i.setAttribute("aria-orientation",n.ort?"vertical":"horizontal"),0===e?l(i,n.cssClasses.handleLower):e===n.handles-1&&l(i,n.cssClasses.handleUpper),r}function z(t,e){return!!e&&L(t,n.cssClasses.connect)}function B(t,e){return!!n.tooltips[e]&&L(t.firstChild,n.cssClasses.tooltip)}function H(t,e,r){var i=M.createElement("div"),a=[];a[A]=n.cssClasses.valueNormal,a[V]=n.cssClasses.valueLarge,a[F]=n.cssClasses.valueSub;var o=[];o[A]=n.cssClasses.markerNormal,o[V]=n.cssClasses.markerLarge,o[F]=n.cssClasses.markerSub;var s=[n.cssClasses.valueHorizontal,n.cssClasses.valueVertical],u=[n.cssClasses.markerHorizontal,n.cssClasses.markerVertical];function c(t,e){var r=e===n.cssClasses.value,i=r?s:u,l=r?a:o;return e+" "+i[n.ort]+" "+l[t]}return l(i,n.cssClasses.pips),l(i,0===n.ort?n.cssClasses.pipsHorizontal:n.cssClasses.pipsVertical),Object.keys(t).forEach(function(a){!function(t,a,o){if((o=e?e(a,o):o)!==P){var s=L(i,!1);s.className=c(o,n.cssClasses.marker),s.style[n.style]=t+"%",o>A&&((s=L(i,!1)).className=c(o,n.cssClasses.value),s.setAttribute("data-value",a),s.style[n.style]=t+"%",s.innerHTML=r.to(a))}}(a,t[a][0],t[a][1])}),i}function I(){var t;m&&((t=m).parentElement.removeChild(t),m=null)}function G(e){I();var r=e.mode,n=e.density||1,i=e.filter||!1,a=e.values||!1,o=e.stepped||!1,s=function(e,r,n){if("range"===e||"steps"===e)return D.xVal;if("count"===e){if(r<2)throw new Error("noUiSlider ("+t+"): 'values' (>= 2) required for mode 'count'.");var i=r-1,a=100/i;for(r=[];i--;)r[i]=i*a;r.push(100),e="positions"}return"positions"===e?r.map(function(t){return D.fromStepping(n?D.getStep(t):t)}):"values"===e?n?r.map(function(t){return D.fromStepping(D.getStep(D.toStepping(t)))}):r:void 0}(r,a,o),l=function(t,e,r){var n,i={},a=D.xVal[0],o=D.xVal[D.xVal.length-1],s=!1,l=!1,u=0;return(n=r.slice().sort(function(t,e){return t-e}),r=n.filter(function(t){return!this[t]&&(this[t]=!0)},{}))[0]!==a&&(r.unshift(a),s=!0),r[r.length-1]!==o&&(r.push(o),l=!0),r.forEach(function(n,a){var o,c,h,d,f,p,m,g,v,x,b=n,y=r[a+1],_="steps"===e;if(_&&(o=D.xNumSteps[a]),o||(o=y-b),!1!==b&&void 0!==y)for(o=Math.max(o,1e-7),c=b;c<=y;c=(c+o).toFixed(7)/1){for(g=(f=(d=D.toStepping(c))-u)/t,x=f/(v=Math.round(g)),h=1;h<=v;h+=1)i[(p=u+h*x).toFixed(5)]=[D.fromStepping(p),0];m=r.indexOf(c)>-1?V:_?F:A,!a&&s&&(m=0),c===y&&l||(i[d.toFixed(5)]=[c,m]),u=d}}),i}(n,r,s),u=e.format||{to:Math.round};return m=w.appendChild(H(l,i,u))}function X(){var t=h.getBoundingClientRect(),e="offset"+["Width","Height"][n.ort];return 0===n.ort?t.width||h[e]:t.height||h[e]}function Y(t,e,r,i){var a=function(a){return!!(a=function(t,e,r){var n,i,a=0===t.type.indexOf("touch"),o=0===t.type.indexOf("mouse"),s=0===t.type.indexOf("pointer");if(0===t.type.indexOf("MSPointer")&&(s=!0),a){var l=function(t){return t.target===r||r.contains(t.target)};if("touchstart"===t.type){var u=Array.prototype.filter.call(t.touches,l);if(u.length>1)return!1;n=u[0].pageX,i=u[0].pageY}else{var h=Array.prototype.find.call(t.changedTouches,l);if(!h)return!1;n=h.pageX,i=h.pageY}}return e=e||c(M),(o||s)&&(n=t.clientX+e.x,i=t.clientY+e.y),t.pageOffset=e,t.points=[n,i],t.cursor=o||s,t}(a,i.pageOffset,i.target||e))&&!(w.hasAttribute("disabled")&&!i.doNotReject)&&(o=w,s=n.cssClasses.tap,!((o.classList?o.classList.contains(s):new RegExp("\\b"+s+"\\b").test(o.className))&&!i.doNotReject)&&!(t===b.start&&void 0!==a.buttons&&a.buttons>1)&&(!i.hover||!a.buttons)&&(_||a.preventDefault(),a.calcPoint=a.points[n.ort],void r(a,i)));var o,s},o=[];return t.split(" ").forEach(function(t){e.addEventListener(t,a,!!_&&{passive:!0}),o.push([t,a])}),o}function q(t){var e,r,i,o,s,l,u=t-(e=h,r=n.ort,i=e.getBoundingClientRect(),o=e.ownerDocument,s=o.documentElement,l=c(o),/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(l.x=0),r?i.top+l.y-s.clientTop:i.left+l.x-s.clientLeft),d=100*u/X();return d=a(d),n.dir?100-d:d}function J(t,e){"mouseout"===t.type&&"HTML"===t.target.nodeName&&null===t.relatedTarget&&$(t,e)}function W(t,e){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===t.buttons&&0!==e.buttonsProperty)return $(t,e);var r=(n.dir?-1:1)*(t.calcPoint-e.startCalcPoint),i=100*r/e.baseSize;at(r>0,i,e.locations,e.handleNumbers)}function $(t,e){e.handle&&(u(e.handle,n.cssClasses.active),E-=1),e.listeners.forEach(function(t){U.removeEventListener(t[0],t[1])}),0===E&&(u(w,n.cssClasses.drag),st(),t.cursor&&(k.style.cursor="",k.removeEventListener("selectstart",r))),e.handleNumbers.forEach(function(t){et("change",t),et("set",t),et("end",t)})}function K(t,e){var i;if(1===e.handleNumbers.length){var a=d[e.handleNumbers[0]];if(a.hasAttribute("disabled"))return!1;i=a.children[0],E+=1,l(i,n.cssClasses.active)}t.stopPropagation();var o=[],s=Y(b.move,U,W,{target:t.target,handle:i,listeners:o,startCalcPoint:t.calcPoint,baseSize:X(),pageOffset:t.pageOffset,handleNumbers:e.handleNumbers,buttonsProperty:t.buttons,locations:S.slice()}),u=Y(b.end,U,$,{target:t.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:e.handleNumbers}),c=Y("mouseout",U,J,{target:t.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:e.handleNumbers});o.push.apply(o,s.concat(u,c)),t.cursor&&(k.style.cursor=getComputedStyle(t.target).cursor,d.length>1&&l(w,n.cssClasses.drag),k.addEventListener("selectstart",r,!1)),e.handleNumbers.forEach(function(t){et("start",t)})}function Q(t){t.stopPropagation();var e=q(t.calcPoint),r=function(t){var e=100,r=!1;return d.forEach(function(n,i){if(!n.hasAttribute("disabled")){var a=Math.abs(S[i]-t);(a<e||100===a&&100===e)&&(r=i,e=a)}}),r}(e);if(!1===r)return!1;n.events.snap||i(w,n.cssClasses.tap,n.animationDuration),lt(r,e,!0,!0),st(),et("slide",r,!0),et("update",r,!0),et("change",r,!0),et("set",r,!0),n.events.snap&&K(t,{handleNumbers:[r]})}function Z(t){var e=q(t.calcPoint),r=D.getStep(e),n=D.fromStepping(r);Object.keys(O).forEach(function(t){"hover"===t.split(".")[0]&&O[t].forEach(function(t){t.call(p,n)})})}function tt(t,e){O[t]=O[t]||[],O[t].push(e),"update"===t.split(".")[0]&&d.forEach(function(t,e){et("update",e)})}function et(t,e,r){Object.keys(O).forEach(function(i){var a=i.split(".")[0];t===a&&O[i].forEach(function(t){t.call(p,N.map(n.format.to),e,N.slice(),r||!1,S.slice())})})}function rt(t){return t+"%"}function nt(t,e,r,i,o,s){return d.length>1&&!n.events.unconstrained&&(i&&e>0&&(r=Math.max(r,t[e-1]+n.margin)),o&&e<d.length-1&&(r=Math.min(r,t[e+1]-n.margin))),d.length>1&&n.limit&&(i&&e>0&&(r=Math.min(r,t[e-1]+n.limit)),o&&e<d.length-1&&(r=Math.max(r,t[e+1]-n.limit))),n.padding&&(0===e&&(r=Math.max(r,n.padding[0])),e===d.length-1&&(r=Math.min(r,100-n.padding[1]))),!((r=a(r=D.getStep(r)))===t[e]&&!s)&&r}function it(t,e){var r=n.ort;return(r?e:t)+", "+(r?t:e)}function at(t,e,r,n){var i=r.slice(),a=[!t,t],o=[t,!t];n=n.slice(),t&&n.reverse(),n.length>1?n.forEach(function(t,r){var n=nt(i,t,i[t]+e,a[r],o[r],!1);!1===n?e=0:(e=n-i[t],i[t]=n)}):a=o=[!0];var s=!1;n.forEach(function(t,n){s=lt(t,r[t]+e,a[n],o[n])||s}),s&&n.forEach(function(t){et("update",t),et("slide",t)})}function ot(t,e){return n.dir?100-t-e:t}function st(){C.forEach(function(t){var e=S[t]>50?-1:1,r=3+(d.length+e*t);d[t].style.zIndex=r})}function lt(t,e,r,i){return!1!==(e=nt(S,t,e,r,i,!1))&&(function(t,e){S[t]=e,N[t]=D.fromStepping(e);var r="translate("+it(rt(ot(e,0)-j),"0")+")";d[t].style[n.transformRule]=r,ut(t),ut(t+1)}(t,e),!0)}function ut(t){if(f[t]){var e=0,r=100;0!==t&&(e=S[t-1]),t!==f.length-1&&(r=S[t]);var i=r-e,a="translate("+it(rt(ot(e,i)),"0")+")",o="scale("+it(i/100,"1")+")";f[t].style[n.transformRule]=a+" "+o}}function ct(t,e){var r=o(t),a=void 0===S[0];e=void 0===e||!!e,n.animate&&!a&&i(w,n.cssClasses.tap,n.animationDuration),C.forEach(function(t){lt(t,function(t,e){return null===t||!1===t||void 0===t?S[e]:("number"==typeof t&&(t=String(t)),t=n.format.from(t),!1===(t=D.toStepping(t))||isNaN(t)?S[e]:t)}(r[t],t),!0,!1)}),C.forEach(function(t){lt(t,S[t],!0,!0)}),st(),C.forEach(function(t){et("update",t),null!==r[t]&&e&&et("set",t)})}function ht(){var t=N.map(n.format.to);return 1===t.length?t[0]:t}return l(x=w,n.cssClasses.target),0===n.dir?l(x,n.cssClasses.ltr):l(x,n.cssClasses.rtl),0===n.ort?l(x,n.cssClasses.horizontal):l(x,n.cssClasses.vertical),h=L(x,n.cssClasses.base),function(t,e){var r=L(e,n.cssClasses.connects);d=[],(f=[]).push(z(r,t[0]));for(var i=0;i<n.handles;i++)d.push(R(e,i)),C[i]=i,f.push(z(r,t[i+1]))}(n.connect,h),(v=n.events).fixed||d.forEach(function(t,e){Y(b.start,t.children[0],K,{handleNumbers:[e]})}),v.tap&&Y(b.start,h,Q,{}),v.hover&&Y(b.move,h,Z,{hover:!0}),v.drag&&f.forEach(function(t,e){if(!1!==t&&0!==e&&e!==f.length-1){var r=d[e-1],i=d[e],a=[t];l(t,n.cssClasses.draggable),v.fixed&&(a.push(r.children[0]),a.push(i.children[0])),a.forEach(function(t){Y(b.start,t,K,{handles:[r,i],handleNumbers:[e-1,e]})})}}),ct(n.start),p={destroy:function(){for(var t in n.cssClasses)n.cssClasses.hasOwnProperty(t)&&u(w,n.cssClasses[t]);for(;w.firstChild;)w.removeChild(w.firstChild);delete w.noUiSlider},steps:function(){return S.map(function(t,e){var r=D.getNearbySteps(t),n=N[e],i=r.thisStep.step,a=null;!1!==i&&n+i>r.stepAfter.startValue&&(i=r.stepAfter.startValue-n),a=n>r.thisStep.startValue?r.thisStep.step:!1!==r.stepBefore.step&&n-r.stepBefore.highestStep,100===t?i=null:0===t&&(a=null);var o=D.countStepDecimals();return null!==i&&!1!==i&&(i=Number(i.toFixed(o))),null!==a&&!1!==a&&(a=Number(a.toFixed(o))),[a,i]})},on:tt,off:function(t){var e=t&&t.split(".")[0],r=e&&t.substring(e.length);Object.keys(O).forEach(function(t){var n=t.split(".")[0],i=t.substring(n.length);e&&e!==n||r&&r!==i||delete O[t]})},get:ht,set:ct,setHandle:function(e,r,n){var i=[];if(!((e=Number(e))>=0&&e<C.length))throw new Error("noUiSlider ("+t+"): invalid handle number, got: "+e);for(var a=0;a<C.length;a++)i[a]=null;i[e]=r,ct(i,n)},reset:function(t){ct(n.start,t)},__moveHandles:function(t,e,r){at(t,e,S,r)},options:s,updateOptions:function(t,e){var r=ht(),i=["margin","limit","padding","range","animate","snap","step","format"];i.forEach(function(e){void 0!==t[e]&&(s[e]=t[e])});var a=T(s);i.forEach(function(e){void 0!==t[e]&&(n[e]=a[e])}),D=a.spectrum,n.margin=a.margin,n.limit=a.limit,n.padding=a.padding,n.pips&&G(n.pips),S=[],ct(t.start||r,e)},target:w,removePips:I,pips:G},n.pips&&G(n.pips),n.tooltips&&(g=d.map(B),tt("update",function(t,e,r){if(g[e]){var i=t[e];!0!==n.tooltips[e]&&(i=n.tooltips[e].to(r[e])),g[e].innerHTML=i}})),tt("update",function(t,e,r,i,a){C.forEach(function(t){var e=d[t],i=nt(S,t,0,!0,!0,!0),o=nt(S,t,100,!0,!0,!0),s=a[t],l=n.ariaFormat.to(r[t]);i=D.fromStepping(i).toFixed(1),o=D.fromStepping(o).toFixed(1),s=D.fromStepping(s).toFixed(1),e.children[0].setAttribute("aria-valuemin",i),e.children[0].setAttribute("aria-valuemax",o),e.children[0].setAttribute("aria-valuenow",s),e.children[0].setAttribute("aria-valuetext",l)})}),p}return{__spectrum:x,version:t,create:function(e,r){if(!e||!e.nodeName)throw new Error("noUiSlider ("+t+"): create requires a single element, got: "+e);if(e.noUiSlider)throw new Error("noUiSlider ("+t+"): Slider was already initialized.");var n=T(r),i=H(e,n,r);return e.noUiSlider=i,i}}})?n.apply(e,i):n)||(t.exports=a)},function(t,e,r){var n,i,a;a=function(){var t,e={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},r=function(){var t=function(t){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=t.xField||t.defaultXField,this._yField=t.yField||t.defaultYField,this._valueField=t.valueField||t.defaultValueField,t.radius&&(this._cfgRadius=t.radius)},r=e.defaultRadius;return t.prototype={_organiseData:function(t,e){var n=t[this._xField],i=t[this._yField],a=this._radi,o=this._data,s=this._max,l=this._min,u=t[this._valueField]||1,c=t.radius||this._cfgRadius||r;o[n]||(o[n]=[],a[n]=[]),o[n][i]?o[n][i]+=u:(o[n][i]=u,a[n][i]=c);var h=o[n][i];return h>s?(e?this.setDataMax(h):this._max=h,!1):h<l?(e?this.setDataMin(h):this._min=h,!1):{x:n,y:i,value:u,radius:c,min:l,max:s}},_unOrganizeData:function(){var t=[],e=this._data,r=this._radi;for(var n in e)for(var i in e[n])t.push({x:n,y:i,radius:r[n][i],value:e[n][i]});return{min:this._min,max:this._max,data:t}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var t=arguments[0],e=t.length;e--;)this.addData.call(this,t[e]);else{var r=this._organiseData(arguments[0],!0);r&&(0===this._data.length&&(this._min=this._max=r.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[r]}))}return this},setData:function(t){var e=t.data,r=e.length;this._data=[],this._radi=[];for(var n=0;n<r;n++)this._organiseData(e[n],!1);return this._max=t.max,this._min=t.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(t){return this._max=t,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(t){return this._min=t,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(t){this._coordinator=t},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},t}(),n=function(){var t=function(t){var e=t.gradient||t.defaultGradient,r=document.createElement("canvas"),n=r.getContext("2d");r.width=256,r.height=1;var i=n.createLinearGradient(0,0,256,1);for(var a in e)i.addColorStop(a,e[a]);return n.fillStyle=i,n.fillRect(0,0,256,1),n.getImageData(0,0,256,1).data},e=function(t,e){var r=document.createElement("canvas"),n=r.getContext("2d"),i=t,a=t;if(r.width=r.height=2*t,1==e)n.beginPath(),n.arc(i,a,t,0,2*Math.PI,!1),n.fillStyle="rgba(0,0,0,1)",n.fill();else{var o=n.createRadialGradient(i,a,t*e,i,a,t);o.addColorStop(0,"rgba(0,0,0,1)"),o.addColorStop(1,"rgba(0,0,0,0)"),n.fillStyle=o,n.fillRect(0,0,2*t,2*t)}return r};function r(e){var r=e.container,n=this.shadowCanvas=document.createElement("canvas"),i=this.canvas=e.canvas||document.createElement("canvas"),a=(this._renderBoundaries=[1e4,1e4,0,0],getComputedStyle(e.container)||{});i.className="heatmap-canvas",this._width=i.width=n.width=e.width||+a.width.replace(/px/,""),this._height=i.height=n.height=e.height||+a.height.replace(/px/,""),this.shadowCtx=n.getContext("2d"),this.ctx=i.getContext("2d"),i.style.cssText=n.style.cssText="position:absolute;left:0;top:0;",r.style.position="relative",r.appendChild(i),this._palette=t(e),this._templates={},this._setStyles(e)}return r.prototype={renderPartial:function(t){t.data.length>0&&(this._drawAlpha(t),this._colorize())},renderAll:function(t){this._clear(),t.data.length>0&&(this._drawAlpha(function(t){for(var e=[],r=t.min,n=t.max,i=t.radi,a=(t=t.data,Object.keys(t)),o=a.length;o--;)for(var s=a[o],l=Object.keys(t[s]),u=l.length;u--;){var c=l[u],h=t[s][c],d=i[s][c];e.push({x:s,y:c,value:h,radius:d})}return{min:r,max:n,data:e}}(t)),this._colorize())},_updateGradient:function(e){this._palette=t(e)},updateConfig:function(t){t.gradient&&this._updateGradient(t),this._setStyles(t)},setDimensions:function(t,e){this._width=t,this._height=e,this.canvas.width=this.shadowCanvas.width=t,this.canvas.height=this.shadowCanvas.height=e},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(t){this._blur=0==t.blur?0:t.blur||t.defaultBlur,t.backgroundColor&&(this.canvas.style.backgroundColor=t.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=t.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=t.height||this._height,this._opacity=255*(t.opacity||0),this._maxOpacity=255*(t.maxOpacity||t.defaultMaxOpacity),this._minOpacity=255*(t.minOpacity||t.defaultMinOpacity),this._useGradientOpacity=!!t.useGradientOpacity},_drawAlpha:function(t){for(var r=this._min=t.min,n=this._max=t.max,i=(t=t.data||[]).length,a=1-this._blur;i--;){var o,s=t[i],l=s.x,u=s.y,c=s.radius,h=Math.min(s.value,n),d=l-c,f=u-c,p=this.shadowCtx;this._templates[c]?o=this._templates[c]:this._templates[c]=o=e(c,a);var m=(h-r)/(n-r);p.globalAlpha=m<.01?.01:m,p.drawImage(o,d,f),d<this._renderBoundaries[0]&&(this._renderBoundaries[0]=d),f<this._renderBoundaries[1]&&(this._renderBoundaries[1]=f),d+2*c>this._renderBoundaries[2]&&(this._renderBoundaries[2]=d+2*c),f+2*c>this._renderBoundaries[3]&&(this._renderBoundaries[3]=f+2*c)}},_colorize:function(){var t=this._renderBoundaries[0],e=this._renderBoundaries[1],r=this._renderBoundaries[2]-t,n=this._renderBoundaries[3]-e,i=this._width,a=this._height,o=this._opacity,s=this._maxOpacity,l=this._minOpacity,u=this._useGradientOpacity;t<0&&(t=0),e<0&&(e=0),t+r>i&&(r=i-t),e+n>a&&(n=a-e);for(var c=this.shadowCtx.getImageData(t,e,r,n),h=c.data,d=h.length,f=this._palette,p=3;p<d;p+=4){var m,g=h[p],v=4*g;if(v)m=o>0?o:g<s?g<l?l:g:s,h[p-3]=f[v],h[p-2]=f[v+1],h[p-1]=f[v+2],h[p]=u?f[v+3]:m}c.data=h,this.ctx.putImageData(c,t,e),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(t){var e=this.shadowCtx.getImageData(t.x,t.y,1,1).data[3],r=this._max,n=this._min;return Math.abs(r-n)*(e/255)>>0},getDataURL:function(){return this.canvas.toDataURL()}},r}(),i=(t=!1,"canvas2d"===e.defaultRenderer&&(t=n),t),a={merge:function(){for(var t={},e=arguments.length,r=0;r<e;r++){var n=arguments[r];for(var i in n)t[i]=n[i]}return t}},o=function(){var t=function(){function t(){this.cStore={}}return t.prototype={on:function(t,e,r){var n=this.cStore;n[t]||(n[t]=[]),n[t].push(function(t){return e.call(r,t)})},emit:function(t,e){var r=this.cStore;if(r[t])for(var n=r[t].length,i=0;i<n;i++){(0,r[t][i])(e)}}},t}(),n=function(t){var e=t._renderer,r=t._coordinator,n=t._store;r.on("renderpartial",e.renderPartial,e),r.on("renderall",e.renderAll,e),r.on("extremachange",function(e){t._config.onExtremaChange&&t._config.onExtremaChange({min:e.min,max:e.max,gradient:t._config.gradient||t._config.defaultGradient})}),n.setCoordinator(r)};function o(){var o=this._config=a.merge(e,arguments[0]||{});if(this._coordinator=new t,o.plugin){var s=o.plugin;if(!e.plugins[s])throw new Error("Plugin '"+s+"' not found. Maybe it was not registered.");var l=e.plugins[s];this._renderer=new l.renderer(o),this._store=new l.store(o)}else this._renderer=new i(o),this._store=new r(o);n(this)}return o.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(t){return this._config=a.merge(this._config,t),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(t){return this._store.getValueAt?this._store.getValueAt(t):this._renderer.getValueAt?this._renderer.getValueAt(t):null}},o}();return{create:function(t){return new o(t)},register:function(t,r){e.plugins[t]=r}}},t.exports?t.exports=a():void 0===(i="function"==typeof(n=a)?n.call(e,r,e,t):n)||(t.exports=i)},function(t,e,r){"use strict";r.r(e);var n=r(1);r.d(e,"Container",function(){return n.a});var i=r(0);r.d(e,"LineHeatmap",function(){return i.a})}])});
- //# sourceMappingURL=line_heatmap.js.map
|