diff --git a/build/development/tauCharts.js b/build/development/tauCharts.js index ab5e6f20e..931637a24 100644 --- a/build/development/tauCharts.js +++ b/build/development/tauCharts.js @@ -2989,7 +2989,7 @@ define('unit-domain-mixin',["exports", "./unit-domain-period-generator", "./util var _domain = function (dim, fnSort) { if (!meta[dim]) { - return [null]; + return []; } var fnMapperId = getValueMapper(dim); @@ -3934,12 +3934,12 @@ define('elements/coords',["exports", "../utils/utils-draw", "../const", "../util var FacetAlgebra = { - CROSS: function (root, dimX, dimY) { - var domainX = root.domain(dimX); - var domainY = root.domain(dimY).reverse(); + CROSS: function (root, dimX, domainX, dimY, domainY) { + var domX = domainX.length === 0 ? [null] : domainX; + var domY = domainY.length === 0 ? [null] : domainY.reverse(); - return _(domainY).map(function (rowVal) { - return _(domainX).map(function (colVal) { + return _(domY).map(function (rowVal) { + return _(domX).map(function (colVal) { var r = {}; if (dimX) { @@ -3977,7 +3977,7 @@ define('elements/coords',["exports", "../utils/utils-draw", "../const", "../util }); var unitFunc = TFuncMap(isFacet ? "CROSS" : ""); - var matrixOfPrFilters = new TMatrix(unitFunc(root, root.x, root.y)); + var matrixOfPrFilters = new TMatrix(unitFunc(root, root.x, root.domain(root.x), root.y, root.domain(root.y))); var matrixOfUnitNodes = new TMatrix(matrixOfPrFilters.sizeR(), matrixOfPrFilters.sizeC()); matrixOfPrFilters.iterate(function (row, col, $whereRC) { diff --git a/build/production/tauCharts.min.js b/build/production/tauCharts.min.js index 5ac7b4170..da3c99ee5 100644 --- a/build/production/tauCharts.min.js +++ b/build/production/tauCharts.min.js @@ -2,5 +2,5 @@ * https://github.com/TargetProcess/tauCharts * Copyright (c) 2015 Taucraft Limited; Licensed Apache License 2.0 */ !function(a,b){if("function"==typeof define&&define.amd)define(["underscore","d3"],function(a,c){return b(a,c)});else if("object"==typeof module&&module.exports){{var c=require("underscore");require("d3")}module.exports=b(c)}else a.tauCharts=b(a._,a.d3)}(this,function(a,b){var c,d,e;return function(a){function b(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(n=n.slice(0,n.length-1),a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(b,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(a,d.concat([b,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(c){if(b(r,c)){var d=r[c];delete r[c],t[c]=!0,m.apply(a,d)}if(!b(q,c)&&!b(t,c))throw new Error("No "+c);return q[c]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(c,d,e,f){var h,k,l,m,n,s,u=[],v=typeof e;if(f=f||c,"undefined"===v||"function"===v){for(d=!d.length&&e.length?["require","exports","module"]:d,n=0;n','','','<%= xTick %>',"","",""].join(""),e=a.template(d),f=document.createElement("div");f.style.position="absolute",f.style.visibility="hidden",f.style.width="100px",f.style.height="100px",f.style.border="1px solid green",document.body.appendChild(f),f.innerHTML=e({xTick:c});var g=b.select(f).selectAll(".x.axis .tick text")[0][0],h={width:0,height:0},i=g.getBoundingClientRect();return h.width=i.right-i.left,h.height=i.bottom-i.top,document.body.removeChild(f),h}};c.utilsDom=e}),e("dsl-reader",["exports"],function(b){var c=function(){var b=function(a,b){this.domain=a,this.UnitsRegistry=b};return b.prototype.buildGraph=function(a){var b=this,c=function(a){return b.UnitsRegistry.get(a.type).walk(b.domain.mix(a),c)};return c(a.unit)},b.prototype.calcLayout=function(a,b){a.options={top:0,left:0,width:b.width,height:b.height};var c=function(a){if(!a.$matrix)return a;var b,d=a.options,e=a.guide.padding,f=d.width-(e.l+e.r),g=d.height-(e.t+e.b),h=a.$matrix.sizeR(),i=a.$matrix.sizeC(),j=f/i,k=g/h;return b=a.guide.split?{calcHeight:function(a,b,c,d){return a/d},calcTop:function(a,b,c,d){return(b+1)*(a/d)*c}}:{calcHeight:function(a){return a},calcTop:function(a,b){return b*k}},a.childUnits=a.childUnits||[],a.$matrix.iterate(function(d,e,f){var g=f.length;f.forEach(function(f,h){f.options={width:j,left:e*j,height:b.calcHeight(k,d,h,g),top:b.calcTop(k,d,h,g)},a.childUnits.push(f),c(f)})}),a};return c(a)},b.prototype.renderGraph=function(b,c,d){var e=this,f=d||function(a){return a};b.options.container=c;var g=function(b){var c=e.domain.mix(b),d=e.UnitsRegistry.get(b.type).draw(c),h=b.childUnits||[];h.forEach(function(c){c.options=a.extend({container:d},c.options),c.parentUnit=b,g(c)}),f(c)};return b.parentUnit=null,g(b),b.options.container},b}();b.DSLReader=c}),e("const",["exports"],function(a){a.CSS_PREFIX="graphical-report__"}),e("api/balloon",["exports","../const"],function(a,b){function c(a,b){for(var c in b)a[c]=b[c];return a}function d(a){return a&&null!=a.setInterval}function e(a){var b=l.pageYOffset||o.scrollTop,e=l.pageXOffset||o.scrollLeft,f={left:0,right:0,top:0,bottom:0,width:0,height:0};if(d(a))f.width=l.innerWidth||o.clientWidth,f.height=l.innerHeight||o.clientHeight;else{if(!o.contains(a)||null==a.getBoundingClientRect)return f;c(f,a.getBoundingClientRect()),f.width=f.right-f.left,f.height=f.bottom-f.top}return f.top=f.top+b-o.clientTop,f.left=f.left+e-o.clientLeft,f.right=f.left+f.width,f.bottom=f.top+f.height,f}function f(a){return 0|Math.round(String(a).replace(/[^\-0-9.]/g,""))}function g(a){var b=String(q(a,g.propName)),c=b.match(/([0-9.]+)([ms]{1,2})/);return c&&(b=Number(c[1]),"s"===c[2]&&(b*=1e3)),0|b}function h(a,b){return this instanceof h?(this.hidden=1,this.options=c(r(h.defaults),b),this._createElement(),void this.content(a)):new h(a,b)}var i=b.CSS_PREFIX,j=function(a){return{add:function(b){a.classList.add(b)},remove:function(b){a.classList.remove(b)}}},k=function(a,b){return a.indexOf(b)},l=window,m=l.document,n=m.body,o=m.documentElement,p=["top","bottom"],q=l.getComputedStyle;g.propName=function(){for(var a=m.createElement("div"),b=["transitionDuration","webkitTransitionDuration"],c="1s",d=0;d=b.bottom&&(c[0]="top"),c[1]){case"left":a.right-this.width<=b.left&&(c[1]="right");break;case"right":a.left+this.width>=b.right&&(c[1]="left");break;default:a.left+a.width/2+this.width/2>=b.right?c[1]="left":a.right-a.width/2-this.width/2<=b.left&&(c[1]="right")}else switch(a.left-this.width-d<=b.left?c[0]="right":a.right+this.width+d>=b.right&&(c[0]="left"),c[1]){case"top":a.bottom-this.height<=b.top&&(c[1]="bottom");break;case"bottom":a.top+this.height>=b.bottom&&(c[1]="top");break;default:a.top+a.height/2+this.height/2>=b.bottom?c[1]="top":a.bottom-a.height/2-this.height/2<=b.top&&(c[1]="bottom")}return c.join("-")},h.prototype.position=function(a,b){this.attachedTo&&(a=this.attachedTo),null==a&&this._p?(a=this._p[0],b=this._p[1]):this._p=arguments;var c="number"==typeof a?{left:0|a,right:0|a,top:0|b,bottom:0|b,width:0,height:0}:e(a),d=this.spacing,f=this._pickPlace(c);f!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(f),this.curPlace=f);var g,h;switch(this.curPlace){case"top":g=c.top-this.height-d,h=c.left+c.width/2-this.width/2;break;case"top-left":g=c.top-this.height-d,h=c.right-this.width;break;case"top-right":g=c.top-this.height-d,h=c.left;break;case"bottom":g=c.bottom+d,h=c.left+c.width/2-this.width/2;break;case"bottom-left":g=c.bottom+d,h=c.right-this.width;break;case"bottom-right":g=c.bottom+d,h=c.left;break;case"left":g=c.top+c.height/2-this.height/2,h=c.left-this.width-d;break;case"left-top":g=c.bottom-this.height,h=c.left-this.width-d;break;case"left-bottom":g=c.top,h=c.left-this.width-d;break;case"right":g=c.top+c.height/2-this.height/2,h=c.right+d;break;case"right-top":g=c.bottom-this.height,h=c.right+d;break;case"right-bottom":g=c.top,h=c.right+d}return this.element.style.top=Math.round(g)+"px",this.element.style.left=Math.round(h)+"px",this},h.prototype.show=function(a,b){return a=this.attachedTo?this.attachedTo:a,clearTimeout(this.aIndex),null!=a&&this.position(a,b),this.hidden&&(this.hidden=0,n.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&void this.element.clientHeight,this.classes.add(this.options.inClass)),this},h.prototype.getElement=function(){return this.element},h.prototype.hide=function(){if(!this.hidden){var a=this,b=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(b=g(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){a.aIndex=0,n.removeChild(a.element),a.hidden=1},b),this}},h.prototype.toggle=function(a,b){return this[this.hidden?"show":"hide"](a,b)},h.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||n.removeChild(this.element),this.element=this.options=null},h.prototype._aware=function(){var a=k(h.winAware,this);~a||h.winAware.push(this)},h.prototype._unaware=function(){var a=k(h.winAware,this);~a&&h.winAware.splice(a,1)},h.reposition=function(){function a(){!c&&h.winAware.length&&(c=d(b))}function b(){c=0;for(var a,b=0,d=h.winAware.length;d>b;b++)a=h.winAware[b],a.position()}var c,d=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(a){return setTimeout(a,17)};return a}(),h.winAware=[],window.addEventListener("resize",h.reposition),window.addEventListener("scroll",h.reposition),h.classTypes=["type","effect"],h.defaults={baseClass:i+"tooltip",typeClass:null,effectClass:null,inClass:"in",place:"top",spacing:null,auto:0},a.Tooltip=h}),e("event",["exports"],function(a){function b(a){var b=d[a];return b||(b=function(){for(var b,c,d=this,e=0;d=d.handler;){if(c=d.callbacks[a],"function"==typeof c){if(!b)for(b=[this],e=0;e=0?-1:1,f=d||1;d-=e*f/b}for(var g=[c,d],h=g[1]-g[0],i=Math.pow(10,Math.floor(Math.log(h/b)/Math.LN10)),j=b/h*i,k=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],l=-1;j>k[++l][0];);i*=k[l][1],g[0]=Math.floor(g[0]/i)*i,g[1]=Math.ceil(g[1]/i)*i;var m=c-g[0],n=g[1]-d,o=i/2;if(c>=0)g[0]=0;else{var p=o>=m?i:0;g[0]=g[0]-p}if(0>=d)g[1]=0;else{var q=o>=n?i:0;g[1]=g[1]+q}return[parseFloat(g[0].toFixed(15)),parseFloat(g[1].toFixed(15))]},traverseJSON:b};a.utils=c}),e("formatter-registry",["exports","d3"],function(b,c){var d=c,e={"x-num-auto":function(a){var b=parseFloat(a.toFixed(2));return Math.abs(b)<1?b.toString():d.format("s")(b)},percent:function(a){var b=parseFloat((100*a).toFixed(2));return b.toString()+"%"},day:d.time.format("%d-%b-%Y"),"day-short":d.time.format("%d-%b"),week:d.time.format("%d-%b-%Y"),"week-short":d.time.format("%d-%b"),month:function(a){var b=new Date(a),c=b.getMonth(),e=0===c?"%B, %Y":"%B";return d.time.format(e)(a)},"month-short":function(a){var b=new Date(a),c=b.getMonth(),e=0===c?"%b '%y":"%b";return d.time.format(e)(a)},"month-year":d.time.format("%B, %Y"),quarter:function(a){var b=new Date(a),c=b.getMonth(),d=(c-c%3)/3;return"Q"+(d+1)+" "+b.getFullYear()},year:d.time.format("%Y"),"x-time-auto":null},f={get:function(b,c){var f=c||"",g=function(a){return(null===a||"undefined"==typeof a?f:a).toString()},h=e.hasOwnProperty(b),i=h?e[b]:g;return h&&(i=e[b]),!h&&b&&(i=function(c){var e=a.isDate(c)?d.time.format(b):d.format(b);return e(c)}),h||b||(i=g),i},add:function(a,b){e[a]=b}};b.FormatterRegistry=f}),e("utils/utils-draw",["exports","../utils/utils","../formatter-registry","underscore","d3"],function(a,b,c,d,e){var f=b.utils,g=c.FormatterRegistry,h=d,i=e,j=function(a,b){return"translate("+a+","+b+")"},k=function(a){return"rotate("+a+")"},l=function(a){return h.contains(["bottom","top"],a.toLowerCase())?"h":"v"},m=function(a,b,c){c=c||function(a){return a.node().getComputedTextLength()},a.each(function(){var a=i.select(this),d=a.text().split(/\s+/),e=!1,f=d.reduce(function(d,f,g){if(e)return d;var h=g>0?[d,f].join(" "):f,i=c(a.text(h));if(b>i)d=h;else{var j=Math.floor(b/i*h.length);d=h.substr(0,j-4)+"...",e=!0}return d},"");a.text(f)})},n=function(a,b,c,d,e,f){f=f||function(a){return a.node().getComputedTextLength()};var g=function(a,b,c,d,e,f,g){var h=g*c+f;return a.append("tspan").attr("x",d).attr("y",e).attr("dy",h+"em").text(b)};a.each(function(){var a=i.select(this),h=a.text().split(/\s+/),j=1.1,k=a.attr("x"),l=a.attr("y"),m=parseFloat(a.attr("dy"));a.text(null);var n=g(a,null,j,k,l,m,0),o=!1,p=h.length-1,q=h.reduce(function(a,d,e){if(o)return a;var g=a.length===c||e===p,h=a[a.length-1],i=""!==h?h+" "+d:d,j=f(n.text(i)),k=j>b;if(k&&g){var l=Math.floor(b/j*i.length);a[a.length-1]=i.substr(0,l-4)+"...",o=!0}return k&&!g&&a.push(d),k||(a[a.length-1]=i),a},[""]).filter(function(a){return a.length>0});l=e?-1*(q.length-1)*Math.floor(.5*d):l,q.forEach(function(b,c){return g(a,b,j,k,l,m,c)}),n.remove()})},o=function(a,b,c){var d=a.selectAll(".tick line"),e=c/d[0].length,f=e/2;if("ordinal"===b.scaleType||"period"===b.scaleType){var g="h"===l(b.guide.scaleOrient),h=g?"x":"y",i=g?f:-f;d.attr(h+"1",i).attr(h+"2",i)}},p=function(a,b){var c=l(b.guide.scaleOrient),d="h"===c?1:-1,e=a.append("text").attr("transform",k(b.guide.label.rotate)).attr("class",b.guide.label.cssClass).attr("x",d*b.guide.size*.5).attr("y",d*b.guide.label.padding).style("text-anchor",b.guide.label.textAnchor),f=" > ",g=b.guide.label.text.split(f),h=g.length;if(g.forEach(function(a,b){e.append("tspan").attr("class","label-token label-token-"+b).text(a),h-1>b&&e.append("tspan").attr("class","label-token-delimiter label-token-delimiter-"+b).text(f)}),"right"===b.guide.label.dock){var i=a.selectAll("path.domain").node().getBBox();e.attr("x","h"===c?i.width:0)}else if("left"===b.guide.label.dock){var i=a.selectAll("path.domain").node().getBBox();e.attr("x","h"===c?0:-i.height)}},q=function(a,b){var c="h"===l(b.guide.scaleOrient),d=b.guide.rotate,e=a.selectAll(".tick text");e.attr("transform",k(d)).style("text-anchor",b.guide.textAnchor),90===d&&e.attr("x",9).attr("y",0),b.guide.tickFormatWordWrap?e.call(n,b.guide.tickFormatWordWrapLimit,b.guide.tickFormatWordWrapLines,b.guide.$maxTickTextH,!c):e.call(m,b.guide.tickFormatWordWrapLimit)},r=function(a,b,c){var d=this;if(a.scaleDim){var e=i.svg.axis().scale(a.scaleObj).orient(a.guide.scaleOrient),f=g.get(a.guide.tickFormat,a.guide.tickFormatNullAlias);null!==f&&(e.ticks(Math.round(c/a.guide.density)),e.tickFormat(f));var h=d.append("g").attr("class",a.guide.cssClass).attr("transform",j.apply(null,b)).call(e);o(h,a,c),q(h,a),p(h,a)}},s=function(a,b,c){var d=this,e=d.append("g").attr("class","grid").attr("transform",j(0,0)),f=(a.guide.showGridLines||"").toLowerCase();if(f.length>0){var h=e.append("g").attr("class","grid-lines");if(f.indexOf("x")>-1&&a.x.scaleDim){var k=a.x,l=i.svg.axis().scale(k.scaleObj).orient(k.guide.scaleOrient).tickSize(b),m=g.get(k.guide.tickFormat);null!==m&&(l.ticks(Math.round(c/k.guide.density)),l.tickFormat(m));var n=h.append("g").attr("class","grid-lines-x").call(l);o(n,k,c);var p=n.select("g.tick");if(p.node()&&"translate(0,0)"!==p.attr("transform")){var q=p.node().cloneNode(!0);h.node().appendChild(q),i.select(q).attr("class","border").attr("transform",j(0,0)).select("line").attr("x1",0).attr("x2",0)}}if(f.indexOf("y")>-1&&a.y.scaleDim){var r=a.y,s=i.svg.axis().scale(r.scaleObj).orient(r.guide.scaleOrient).tickSize(-c),m=g.get(r.guide.tickFormat);null!==m&&(s.ticks(Math.round(b/r.guide.density)),s.tickFormat(m));var t=h.append("g").attr("class","grid-lines-y").call(s);o(t,r,b)}h.selectAll("text").remove()}return e},t=h.times(10,function(a){return"color10-"+(1+a)}),u=function(a){var b,c,d=a.guide.color||{},e=a.color,g=e.scaleDim,h=d.brewer||t;f.isArray(h)?(c=a.domain(g).map(function(a){return String(a).toString()}),b=h):(c=Object.keys(h),b=c.map(function(a){return h[a]}));var j=i.scale.ordinal().range(b).domain(c),k=function(a){return c.indexOf(a)>-1?j(a):"color-default"};return{get:function(a){return k(String(a).toString())},dimension:g}},v=function(a,b,c){return a[b]=h.defaults(a[b]||{},{label:""}),a[b].label=h.isObject(a[b].label)?a[b].label:{text:a[b].label},a[b].label=h.defaults(a[b].label,c||{},{padding:32,rotate:0,textAnchor:"middle",cssClass:"label",dock:null}),a[b]},w=function(a,b,c){return a[b]=h.defaults(a[b],c||{},{padding:0,density:30,rotate:0,tickPeriod:null,tickFormat:null,autoScale:!0}),a[b].tickFormat=a[b].tickFormat||a[b].tickPeriod,a[b]},x=function(a){return a.options=a.options||{},a.guide=a.guide||{},a.guide.padding=h.defaults(a.guide.padding||{},{l:0,b:0,r:0,t:0}),a.guide.x=v(a.guide,"x"),a.guide.x=w(a.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),a.guide.y=v(a.guide,"y",{rotate:-90}),a.guide.y=w(a.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),a.guide.size=v(a.guide,"size"),a.guide.color=v(a.guide,"color"),a},y={translate:j,rotate:k,getOrientation:l,fnDrawDimAxis:r,fnDrawGrid:s,generateColor:u,applyNodeDefaults:x,cutText:m,wrapText:n};a.utilsDraw=y}),e("spec-engine-factory",["exports","./utils/utils","./utils/utils-draw","./formatter-registry"],function(b,c,d,e){function f(b,c,d,e){var f=b.hasOwnProperty(d)?b[d]:{};a.each(e,function(b){a.extend(c.guide[d][b],f[b])}),a.extend(c.guide[d],a.omit.apply(a,[f].concat[e]))}var g=c.utils,h=d.utilsDraw,i=e.FormatterRegistry,j=function(b,c){var d=c.guide||{},e={x:["label"],y:["label"],size:["label"],color:["label"],padding:[]};return a.each(e,function(a,c){f(d,b,c,a)}),a.extend(b.guide,a.omit.apply(a,[d].concat(a.keys(e)))),b},k=function(b,c){return b.guide=b.guide||{},b.guide.padding=b.guide.padding||{l:0,t:0,r:0,b:0},b.hasOwnProperty("unit")||(b=a.defaults(b,c),b.guide=a.defaults(b.guide,g.clone(c.guide)),b.guide.x=a.defaults(b.guide.x,g.clone(c.guide.x)),b.guide.y=a.defaults(b.guide.y,g.clone(c.guide.y))),b},l=function(a){var b=a.unit||[],c=!a.hasOwnProperty("unit"),d=!b.some(function(a){return a.hasOwnProperty("unit")});return{type:a.type,isLeaf:c,isLeafParent:!c&&d}},m=function(b,c,d,e){if(0===b.length)return{width:0,height:0};if(null===c){var f=d("TauChart Library");return f.width=.625*e,f}var g=a.max(b,function(a){return c(a).toString().length}),h=a.isNumber(g)?".00":"";return d(c(g)+h)},n=function(a,b,c){var d=a.dimType,e=a.scaleType,f="*";if("measure"===d&&"time"===e){var g=b.source.filter(function(a){return null!==a}).sort(),h=0;if(g.length>1){for(var i=1,j=g.length,k=[];j>i;)k.push(g[i]-g[i-1]),++i;var l=k.reduce(function(a,b){return a+=b},0);h=l/k.length}var m=[[31536e6,"year"],[7776e6,"quarter"],[2592e6,"month"],[6048e5,"week"],[864e5,"day"],[36e5,"hour"],[6e4,"min"],[1e3,"sec"],[0,"ms"]],n=-1;do++n;while(m[n][0]>h);f=m[n][1]}var o=[d,e,f].join(":"),p=[d,e].join(":");return c[o]||c[p]||c[d]||null},o=function(a,b,c,d,e,f){var g=b.dimension(a.x),h=b.dimension(a.y),j="measure"===g.dimType,k="measure"===h.dimType,l=c.hasOwnProperty("xDensityPadding:"+g.dimType)?c["xDensityPadding:"+g.dimType]:c.xDensityPadding,o=c.hasOwnProperty("yDensityPadding:"+h.dimType)?c["yDensityPadding:"+h.dimType]:c.yDensityPadding,p=b.scaleMeta(a.x,a.guide.x),q=p.values,r=b.scaleMeta(a.y,a.guide.y),s=r.values;a.guide.x.tickFormat=a.guide.x.tickFormat||n(g,p,c.defaultFormats),a.guide.y.tickFormat=a.guide.y.tickFormat||n(h,r,c.defaultFormats),["day","week","month"].indexOf(a.guide.x.tickFormat)>=0&&(a.guide.x.tickFormat+="-short"),["day","week","month"].indexOf(a.guide.y.tickFormat)>=0&&(a.guide.y.tickFormat+="-short");var t=0===q.length,u=0===s.length,v=m(q,i.get(a.guide.x.tickFormat,a.guide.x.tickFormatNullAlias),c.getAxisTickLabelSize,c.xAxisTickLabelLimit),w=m(s,i.get(a.guide.y.tickFormat,a.guide.y.tickFormatNullAlias),c.getAxisTickLabelSize,c.yAxisTickLabelLimit),x=c.xAxisPadding,y=c.yAxisPadding,z=d?!j:!1,A=e?!k:!1;a.guide.x.padding=t?0:x,a.guide.y.padding=u?0:y,a.guide.x.rotate=z?90:0,a.guide.x.textAnchor=z?"start":a.guide.x.textAnchor,a.guide.y.rotate=A?-90:0,a.guide.y.textAnchor=A?"middle":a.guide.y.textAnchor;var B=t?0:c.xTickWidth,C=u?0:c.yTickWidth;a.guide.x.tickFormatWordWrapLimit=c.xAxisTickLabelLimit,a.guide.y.tickFormatWordWrapLimit=c.yAxisTickLabelLimit;var D=z?{w:v.height,h:v.width}:{h:v.height,w:v.width};if(v.width>c.xAxisTickLabelLimit){a.guide.x.tickFormatWordWrap=!0,a.guide.x.tickFormatWordWrapLines=c.xTickWordWrapLinesLimit;var E=Math.ceil(v.width/c.xAxisTickLabelLimit),F=Math.min(E,c.xTickWordWrapLinesLimit),G=F*v.height;z?(D.h=c.xAxisTickLabelLimit,D.w=G):(D.h=G,D.w=c.xAxisTickLabelLimit)}var H=A?{w:w.height,h:w.width}:{h:w.height,w:w.width};if(w.width>c.yAxisTickLabelLimit){a.guide.y.tickFormatWordWrap=!0,a.guide.y.tickFormatWordWrapLines=c.yTickWordWrapLinesLimit;var E=Math.ceil(w.width/c.yAxisTickLabelLimit),F=Math.min(E,c.yTickWordWrapLinesLimit),G=F*w.height;A?(H.w=G,H.h=c.yAxisTickLabelLimit):(H.w=c.yAxisTickLabelLimit,H.h=G)}var I=B+D.h,J=C+H.w,K=c.xFontLabelHeight,L=c.yFontLabelHeight,M=c.distToXAxisLabel,N=c.distToYAxisLabel;if(a.guide.x.density=D.w+2*l,a.guide.y.density=H.h+2*o,f){var O=(x-K)/2;a.guide.x.label.padding=0+K-M+O,a.guide.y.label.padding=0-N+O,a.guide.x.label.cssClass+=" inline",a.guide.x.label.dock="right",a.guide.x.label.textAnchor="end",a.guide.y.label.cssClass+=" inline",a.guide.y.label.dock="right",a.guide.y.label.textAnchor="end",a.guide.padding.b=x+I,a.guide.padding.l=y+J,a.guide.padding.b=a.guide.x.hide?0:a.guide.padding.b,a.guide.padding.l=a.guide.y.hide?0:a.guide.padding.l}else{a.guide.x.label.padding=+K+(a.guide.x.label.text?I+M:0),a.guide.y.label.padding=-K+(a.guide.y.label.text?J+N:0);var P=a.guide.x.label.text?a.guide.x.label.padding+K:I,Q=a.guide.y.label.text?a.guide.y.label.padding+L:J;a.guide.padding.b=x+P-B,a.guide.padding.l=y+Q,a.guide.padding.b=a.guide.x.hide?0:a.guide.padding.b,a.guide.padding.l=a.guide.y.hide?0:a.guide.padding.l}return a.guide.x.tickFontHeight=v.height,a.guide.y.tickFontHeight=w.height,a.guide.x.$minimalDomain=q.length,a.guide.y.$minimalDomain=s.length,a.guide.x.$maxTickTextW=v.width,a.guide.x.$maxTickTextH=v.height,a.guide.y.$maxTickTextW=w.width,a.guide.y.$maxTickTextH=w.height,a},p={NONE:function(a,b,c){var d=g.clone(a);return q(g.clone(d.unit),d.unit,function(a,b){return b.guide.x.tickFontHeight=c.getAxisTickLabelSize("X").height,b.guide.y.tickFontHeight=c.getAxisTickLabelSize("Y").height,b}),d},"BUILD-LABELS":function(b){var c=g.clone(b),d=[],e=[],f=null,h=null;return g.traverseJSON(c.unit,"unit",l,function(b,c){if(b.isLeaf)return c;!f&&c.x&&(f=c),!h&&c.y&&(h=c),c.guide=c.guide||{},c.guide.x=c.guide.x||{label:""},c.guide.y=c.guide.y||{label:""},c.guide.x.label=a.isObject(c.guide.x.label)?c.guide.x.label:{text:c.guide.x.label},c.guide.y.label=a.isObject(c.guide.y.label)?c.guide.y.label:{text:c.guide.y.label},c.x&&(c.guide.x.label.text=c.guide.x.label.text||c.x),c.y&&(c.guide.y.label.text=c.guide.y.label.text||c.y);var g=c.guide.x.label.text;g&&(d.push(g),c.guide.x.tickFormatNullAlias=c.guide.x.hasOwnProperty("tickFormatNullAlias")?c.guide.x.tickFormatNullAlias:"No "+g,c.guide.x.label.text="");var i=c.guide.y.label.text;return i&&(e.push(i),c.guide.y.tickFormatNullAlias=c.guide.y.hasOwnProperty("tickFormatNullAlias")?c.guide.y.tickFormatNullAlias:"No "+i,c.guide.y.label.text=""),c}),f&&(f.guide.x.label.text=d.join(" > ")),h&&(h.guide.y.label.text=e.join(" > ")),c},"BUILD-GUIDE":function(a,b,c){var d=g.clone(a);return q(g.clone(d.unit),d.unit,function(a,d){if(a.isLeaf)return d;a.isLeafParent&&!d.guide.hasOwnProperty("showGridLines")&&(d.guide.showGridLines="xy");var e=!a.isLeaf&&!a.isLeafParent;e&&(d.guide.x.cssClass+=" facet-axis",d.guide.y.cssClass+=" facet-axis");var f=b.dimension(d.x),g=b.dimension(d.y),h="measure"===f.dimType,j="measure"===g.dimType,k=c.hasOwnProperty("xDensityPadding:"+f.dimType)?c["xDensityPadding:"+f.dimType]:c.xDensityPadding,l=c.hasOwnProperty("yDensityPadding:"+g.dimType)?c["yDensityPadding:"+g.dimType]:c.yDensityPadding,o=b.scaleMeta(d.x,d.guide.x),p=o.values,q=b.scaleMeta(d.y,d.guide.y),r=q.values;d.guide.x.tickFormat=d.guide.x.tickFormat||n(f,o,c.defaultFormats),d.guide.y.tickFormat=d.guide.y.tickFormat||n(g,q,c.defaultFormats);var s=0===p.length,t=0===r.length,u=m(p,i.get(d.guide.x.tickFormat,d.guide.x.tickFormatNullAlias),c.getAxisTickLabelSize,c.xAxisTickLabelLimit),v=m(r,i.get(d.guide.y.tickFormat,d.guide.y.tickFormatNullAlias),c.getAxisTickLabelSize,c.yAxisTickLabelLimit),w=a.isLeafParent?c.xAxisPadding:0,x=a.isLeafParent?c.yAxisPadding:0,y=!e&&!!f.dimType&&"measure"!==f.dimType;d.guide.x.padding=s?0:w,d.guide.y.padding=t?0:x,d.guide.x.rotate=y?90:0,d.guide.x.textAnchor=y?"start":d.guide.x.textAnchor;var z=s?0:c.xTickWidth,A=t?0:c.yTickWidth;d.guide.x.tickFormatWordWrapLimit=c.xAxisTickLabelLimit,d.guide.y.tickFormatWordWrapLimit=c.yAxisTickLabelLimit;var B=y?u.width:u.height;!h&&B>c.xAxisTickLabelLimit&&(B=c.xAxisTickLabelLimit),!y&&u.width>c.xAxisTickLabelLimit&&(d.guide.x.tickFormatWordWrap=!0,d.guide.x.tickFormatWordWrapLines=c.xTickWordWrapLinesLimit,B=c.xTickWordWrapLinesLimit*u.height);var C=v.width;!j&&C>c.yAxisTickLabelLimit&&(C=c.yAxisTickLabelLimit,d.guide.y.tickFormatWordWrap=!0,d.guide.y.tickFormatWordWrapLines=c.yTickWordWrapLinesLimit);var D=z+B,E=A+C,F=c.xFontLabelHeight,G=c.yFontLabelHeight,H=c.distToXAxisLabel,I=c.distToYAxisLabel,J=Math.min(c.xAxisTickLabelLimit,y?u.height:u.width);d.guide.x.density=J+2*k;var K=Math.ceil(v.width/c.yAxisTickLabelLimit),L=Math.min(K,c.yTickWordWrapLinesLimit),M=Math.min(c.yAxisTickLabelLimit,L*v.height);d.guide.y.density=M+2*l,d.guide.x.label.padding=d.guide.x.label.text?D+H:0,d.guide.y.label.padding=d.guide.y.label.text?E+I:0;var N=d.guide.x.label.text?d.guide.x.label.padding+F:D,O=d.guide.y.label.text?d.guide.y.label.padding+G:E;return d.guide.padding.b=w+N,d.guide.padding.l=x+O,d.guide.padding.b=d.guide.x.hide?0:d.guide.padding.b,d.guide.padding.l=d.guide.y.hide?0:d.guide.padding.l,d.guide.x.tickFontHeight=u.height,d.guide.y.tickFontHeight=v.height,d.guide.x.$minimalDomain=p.length,d.guide.y.$minimalDomain=r.length,d.guide.x.$maxTickTextW=u.width,d.guide.x.$maxTickTextH=u.height,d.guide.y.$maxTickTextW=v.width,d.guide.y.$maxTickTextH=v.height,d}),d},"BUILD-COMPACT":function(b,c,d){var e=g.clone(b);return q(g.clone(e.unit),e.unit,function(b,e){return b.isLeaf?e:b.isLeafParent?(e.guide.showGridLines=e.guide.hasOwnProperty("showGridLines")?e.guide.showGridLines:"xy",o(e,c,a.defaults({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},d),!0,!1,!0)):(e.guide.x.cssClass+=" facet-axis compact",e.guide.y.cssClass+=" facet-axis compact",o(e,c,a.defaults({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},d),!1,!0,!1))}),e}};p.AUTO=function(a,b,c){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(a,d){return p[d](a,b,c)},a)},p.COMPACT=function(a,b,c){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(a,d){return p[d](a,b,c)},a)};var q=function(b,c,d){var e=h.applyNodeDefaults(c);e=d(l(e),e),e=j(e,b);var f=a.omit(e,"unit");return(e.unit||[]).forEach(function(a){return q(g.clone(a),k(a,f),d)}),e},r={get:function(a,b){var c=p[a]||p.NONE;return function(a,d){return c(a,d,b)}}};b.SpecEngineFactory=r}),e("matrix",["exports"],function(b){var c=function(){var b=function(b,c){var d,e=a.toArray(arguments);d=a.isArray(e[0])?e[0]:a.times(b,function(){return a.times(c,function(){return null})}),this.cube=d};return b.prototype={iterate:function(b){var c=this.cube;return a.each(c,function(c,d){a.each(c,function(a,c){b(d,c,a)})}),this},getRC:function(a,b){return this.cube[a][b]},setRC:function(a,b,c){return this.cube[a][b]=c,this},sizeR:function(){return this.cube.length},sizeC:function(){var a=this.cube[0]||[];return a.length}},b}();b.TMatrix=c}),e("layout-engine-factory",["exports","./utils/utils","./utils/utils-draw","./matrix"],function(a,b,c,d){var e=b.utils,f=c.utilsDraw,g=d.TMatrix,h=function(a,b){var c=b?b:{depth:-1,paddings:[]},d=a.guide.padding; -return c.depth+=1,c.paddings.unshift({l:d.l,b:d.b,r:d.r,t:d.t}),a.unit&&a.unit.length&&h(a.unit[0],c),c},i={NONE:function(a){return a},EXTRACT:function(a){var b=function(a,c,d){var e=a,f=e.sizeR(),h=e.sizeC();e.iterate(function(a,e,i){i.forEach(function(b){return d(b,{firstRow:0===a,firstCol:0===e,lastRow:a===f-1,lastCol:e===h-1,depth:c})}),i.filter(function(a){return a.$matrix}).forEach(function(a){a.$matrix=new g(a.$matrix.cube),b(a.$matrix,c-1,d)})})},c=e.clone(a),d=new g([[[c]]]),i=h(c),j=i.paddings.reduce(function(a,b){return a.l+=b.l,a.b+=b.b,a},{l:0,b:0}),k=e.clone(j),l=i.paddings.reverse().map(function(a){return a.l=k.l-a.l,a.b=k.b-a.b,k={l:a.l,b:a.b},a});i.paddings=l.reverse();var m=10,n=f.applyNodeDefaults({type:"COORDS.RECT",options:e.clone(a.options),$matrix:new g([[[c]]]),guide:{padding:{l:j.l-m,b:j.b-m,r:0,t:0}}});return b(d,i.depth,function(a,b){var c=b.depth;a.guide.x.hide=a.guide.x.hide?a.guide.x.hide:!b.lastRow,a.guide.y.hide=a.guide.y.hide?a.guide.y.hide:!b.firstCol;var d=c>1?0:m,e=c>1?m:0;return a.guide.x.padding+=i.paddings[c].b,a.guide.y.padding+=i.paddings[c].l,a.guide.x.padding-=e,a.guide.y.padding-=e,a.guide.padding.l=d,a.guide.padding.b=d,a.guide.padding.r=d,a.guide.padding.t=d,a}),n}},j={get:function(a){return i[a]||i.NONE}};a.LayoutEngineFactory=j}),e("plugins",["exports"],function(a){var c=function(){var a=function(a,b){this.chart=b,this._plugins=a.map(this.initPlugin,this)};return a.prototype.initPlugin=function(a){var b=this;a.init&&a.init(this.chart),this.chart.on("destroy",a.destroy&&a.destroy.bind(a)||function(){}),Object.keys(a).forEach(function(c){if(0===c.indexOf("on")){var d=c.substr(2);b.chart.on(d.toLowerCase(),a[c].bind(a))}})},a}(),d=["click","mouseover","mouseout","mousemove"],e=function(a){return function(){d.forEach(function(c){this.on(c,function(d){a.fire("element"+c,{elementData:d,element:this,cellData:b.select(this.parentNode.parentNode).datum()})})},this)}};a.propagateDatumEvents=e,a.Plugins=c}),e("unit-domain-period-generator",["exports"],function(a){var b={day:{cast:function(a){return new Date(a.setHours(0,0,0,0))},next:function(a){return new Date(a.setDate(a.getDate()+1))}},week:{cast:function(a){return a=new Date(a.setHours(0,0,0,0)),a=new Date(a.setDate(a.getDate()-a.getDay()))},next:function(a){return new Date(a.setDate(a.getDate()+7))}},month:{cast:function(a){return a=new Date(a.setHours(0,0,0,0)),a=new Date(a.setDate(1))},next:function(a){return new Date(a.setMonth(a.getMonth()+1))}},quarter:{cast:function(a){a=new Date(a.setHours(0,0,0,0)),a=new Date(a.setDate(1));var b=a.getMonth(),c=b-b%3;return new Date(a.setMonth(c))},next:function(a){return new Date(a.setMonth(a.getMonth()+3))}},year:{cast:function(a){return a=new Date(a.setHours(0,0,0,0)),a=new Date(a.setDate(1)),a=new Date(a.setMonth(0))},next:function(a){return new Date(a.setFullYear(a.getFullYear()+1))}}},c={add:function(a,c){return b[a.toLowerCase()]=c,this},get:function(a){return b[a.toLowerCase()]},generate:function(a,c,d){var e=[],f=b[d.toLowerCase()];if(f){var g=f.cast(new Date(c)),h=f.cast(new Date(a));for(e.push(h);(h=f.next(new Date(h)))<=g;)e.push(h)}return e}};a.UnitDomainPeriodGenerator=c}),e("unit-domain-mixin",["exports","./unit-domain-period-generator","./utils/utils","underscore","d3"],function(a,b,c,d,e){var f=b.UnitDomainPeriodGenerator,g=c.utils,h=d,i=e,j={ordinal:function(a){return a},linear:function(a,b){var c=b.autoScale?g.autoScale(a):i.extent(a),d=h.isNumber(b.min)?b.min:c[0],e=h.isNumber(b.max)?b.max:c[1];return[Math.min(d,c[0]),Math.max(e,c[1])]},period:function(a,b){var c=i.extent(a),d=h.isNull(b.min)||h.isUndefined(b.min)?c[0]:new Date(b.min).getTime(),e=h.isNull(b.max)||h.isUndefined(b.max)?c[1]:new Date(b.max).getTime(),g=[new Date(Math.min(d,c[0])),new Date(Math.max(e,c[1]))];return f.generate(g[0],g[1],b.period)},time:function(a,b){var c=i.extent(a),d=h.isNull(b.min)||h.isUndefined(b.min)?c[0]:new Date(b.min).getTime(),e=h.isNull(b.max)||h.isUndefined(b.max)?c[1]:new Date(b.max).getTime();return[new Date(Math.min(d,c[0])),new Date(Math.max(e,c[1]))]}},k={ordinal:function(a,b){return i.scale.ordinal().domain(a).rangePoints(b,1)},linear:function(a,b){return i.scale.linear().domain(a).rangeRound(b,1)},period:function(a,b){return i.scale.ordinal().domain(a).rangePoints(b,1)},time:function(a,b){return i.time.scale().domain(a).range(b)}},l=function(){var a=function(a,b){var c=function(a){return function(b){var c=b||{};return c.hasOwnProperty(a)?c[a]:null}},d=function(b){var d=a[b]||{},e=d.value?c(d.value):function(a){return a},f=h.contains(["period","time"],d.scale);return f?h.compose(function(a){return new Date(a).getTime()},e):e},e=function(b){var c=a[b]||{};return c.order||null},g=function(a){var b={category:function(a,b,c){return c},order:function(a,b,c){var d=e(a);return d?h.union(d,c):h.sortBy(c,b)},measure:function(a,b,c){return h.sortBy(c,b)},"as-is":function(a,b,c){return c}};return b[a]||b["as-is"]},i=function(a){var b={category:g("category"),order:g("order"),measure:g("measure"),"as-is":g("as-is")};return b[a]||b["as-is"]};this.fnDimension=function(b,c){var d=(c||{}).dimensions||{},e=a[b]||{},f=d[b]||{};return{scaleDim:b,scaleType:f.scale||e.scale,dimType:f.type||e.type}},this.fnSource=function(a){var c=h.map(a,function(a,b){return function(c){return d(b)(c[b])===a}});return h(b).filter(function(a){return h.every(c,function(b){return b(a)})})};var l=function(c,e){if(!a[c])return[null];var f=d(c),g=h(b).chain().pluck(c).uniq(f).value();return e(c,f,g)};this.fnDomain=function(b){var c=d(b),e=(a[b]||{}).type,f=l(b,g(e));return f.map(c)};var m=function(b,e){var g={},k=e||{};g.map=k.hasOwnProperty("map")?k.map:k.tickLabel,g.min=k.hasOwnProperty("min")?k.min:k.tickMin,g.max=k.hasOwnProperty("max")?k.max:k.tickMax,g.period=k.hasOwnProperty("period")?k.period:k.tickPeriod,g.autoScale=k.autoScale;var m=h.defaults({},a[b]),n={"order:period":function(a){return function(b){return f.get(a.period).cast(new Date(b))}},"*":function(){return function(a){return a}}},o=g.map?c(g.map):d(b),p=[m.type,m.scale].join(":"),q=(n[p]||n["*"])(g),r=l(b,i(m.type)).map(o),s=m.scale?j[m.scale](r,g):[];return{extract:function(a){return q(o(a))},values:s,source:r}};this.fnScaleMeta=m,this.fnScaleTo=function(b,c,d){var e=d||{},f=h.defaults({},a[b]),g=m(b,d),i=k[f.scale](g.values,c,e),j=function(a){return i(g.extract(a))};return Object.keys(i).forEach(function(a){return j[a]=i[a]}),j}};return a.prototype.mix=function(a){return a.dimension=this.fnDimension,a.source=this.fnSource,a.domain=this.fnDomain,a.scaleMeta=this.fnScaleMeta,a.scaleTo=this.fnScaleTo,a.partition=function(){return a.data||a.source(a.$where)},a.groupBy=function(a,b){return i.nest().key(function(a){return a[b]}).entries(a)},a},a}();a.UnitDomainMixin=l}),e("units-registry",["exports"],function(a){var b={},c={add:function(a,c){var d={};return d.draw="function"==typeof c?c:c.draw,d.walk=c.walk||function(a){return a},b[a]=d,this},get:function(a){if(!b.hasOwnProperty(a))throw new Error("Unknown unit type: "+a);return b[a]}};a.UnitsRegistry=c}),e("data-processor",["exports","./utils/utils"],function(b,c){var d=c.utils,e={isYFunctionOfX:function(a,b,c){var d=!0,e=null;try{a.reduce(function(a,d){var f=function(a,b){return a.push(d[b]),a},g=b.reduce(f,[]).join("/"),h=c.reduce(f,[]).join("/");if(a.hasOwnProperty(g)){var i=a[g];if(i!==h)throw e={type:"RelationIsNotAFunction",keyX:b.join("/"),keyY:c.join("/"),valX:g,errY:[i,h]},new Error("RelationIsNotAFunction")}else a[g]=h;return a},{})}catch(f){if("RelationIsNotAFunction"!==f.message)throw f;d=!1}return{result:d,error:e}},excludeNullValues:function(a,b){var c=Object.keys(a).reduce(function(b,c){var d=a[c];return d.hasOwnProperty("hasNull")&&!d.hasNull||"measure"!==d.type&&"period"!==d.scale||b.push(c),b},[]);return function(a){var d=!c.some(function(b){return!(b in a)||null===a[b]});return d||b(a),d}},autoAssignScales:function(a){var b="category",c={category:"ordinal",order:"ordinal",measure:"linear"},d={};return Object.keys(a).forEach(function(e){var f=a[e],g=(f.type||b).toLowerCase();d[e]={},d[e].type=g,d[e].scale=f.scale||c[g],d[e].value=f.value}),d},autoDetectDimTypes:function(b){var c={type:"category",scale:"ordinal"},e=function(b,c){var d=c;return a.isDate(b)?(d.type="measure",d.scale="time"):a.isObject(b)?(d.type="order",d.scale="ordinal"):a.isNumber(b)&&(d.type="measure",d.scale="linear"),d},f=function(a,b){return Object.keys(b).forEach(function(f){var g=b.hasOwnProperty(f)?b[f]:null;if(a[f]=a[f]||{type:null,hasNull:!1},null===g)a[f].hasNull=!0;else{var h=e(g,d.clone(c)),i=h.type,j=h.scale,k=null!==a[f].type&&a[f].type!==i;a[f].type=k?c.type:i,a[f].scale=k?c.scale:j}}),a};return a.reduce(b,f,{})}};b.DataProcessor=e}),e("utils/layuot-template",["exports","../const"],function(a,b){var c=b.CSS_PREFIX,d=function(a,b){var d="div",e=document.createElement(d);return e.classList.add(c+a),b&&b.appendChild(e),e},e=function(){var a=d("layout"),b=d("layout__header",a),c=d("layout__container",a),e=d("layout__sidebar",c),f=d("layout__content",c),g=d("layout__content__wrap",f),h=d("layout__sidebar-right",c),i=d("layout__sidebar-right__wrap",h),j=d("layout__footer",a);return{layout:a,header:b,content:g,leftSidebar:e,rightSidebar:i,footer:j}};a.getLayout=e}),e("charts/tau.plot",["exports","../dsl-reader","../api/balloon","../event","../spec-engine-factory","../layout-engine-factory","../plugins","../utils/utils","../utils/utils-dom","../const","../unit-domain-mixin","../units-registry","../data-processor","../utils/layuot-template"],function(c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=function(a,b){a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),a.__proto__=b},r=d.DSLReader,s=e.Tooltip,t=f.Emitter,u=g.SpecEngineFactory,v=h.LayoutEngineFactory,w=i.Plugins,x=i.propagateDatumEvents,y=j.utils,z=k.utilsDom,A=l.CSS_PREFIX,B=m.UnitDomainMixin,C=n.UnitsRegistry,D=o.DataProcessor,E=p.getLayout,F=function(a){var b;if(a.unit){var c=F(a.unit[0]),d=a.guide,e=d.x.$minimalDomain||1,f=d.y.$minimalDomain||1,g=Math.max(e*d.x.density,e*c.w),h=Math.max(f*d.y.density,f*c.h);b={w:g+d.padding.l+d.padding.r,h:h+d.padding.t+d.padding.b}}else b={w:0,h:0};return b},G=function(a,b,c,d){var e=b.guide.x.$minimalDomain||1,f=b.guide.y.$minimalDomain||1,g=c.width/e,h=c.height/f,i=a.dimension(b.x),j=a.dimension(b.y),k=d.hasOwnProperty("xDensityPadding:"+i.dimType)?d["xDensityPadding:"+i.dimType]:d.xDensityPadding,l=d.hasOwnProperty("yDensityPadding:"+j.dimType)?d["yDensityPadding:"+j.dimType]:d.yDensityPadding;if(b.guide.x.hide!==!0&&0!==b.guide.x.rotate&&g>b.guide.x.$maxTickTextW+2*k){b.guide.x.rotate=0,b.guide.x.textAnchor="middle",b.guide.x.tickFormatWordWrapLimit=g;var m=Math.min(d.xAxisTickLabelLimit,b.guide.x.$maxTickTextW),n=0-m+b.guide.x.$maxTickTextH;b.guide.padding.b+=b.guide.padding.b>0?n:0,b.guide.x.label.padding>m+d.xAxisPadding&&(b.guide.x.label.padding+=n)}b.guide.y.hide!==!0&&0!==b.guide.y.rotate&&1===b.guide.y.tickFormatWordWrapLines&&h>b.guide.y.$maxTickTextW+2*l&&(b.guide.y.tickFormatWordWrapLimit=h-2*l);var o={width:g,height:h};b.unit&&G(a,b.unit[0],o,d)},H=function(c){var d=function(a){c.call(this),this._svg=null,this._filtersStore={filters:{},tick:0},this._layout=E(),this.setupConfig(a),this._plugins=new w(this.config.plugins,this)};return q(d,c),d.prototype.setupConfig=function(b){this.config=a.defaults(b,{spec:{},data:[],plugins:[],settings:{}}),this._emptyContainer=b.emptyContainer||"",this.config.settings.specEngine=this.config.specEngine||this.config.settings.specEngine,this.config.settings.layoutEngine=this.config.layoutEngine||this.config.settings.layoutEngine,this.config.settings=this.setupSettings(this.config.settings),y.isArray(this.config.settings.specEngine)||(this.config.settings.specEngine=[{width:Number.MAX_VALUE,name:this.config.settings.specEngine}]),this.config.spec.dimensions=this.setupMetaInfo(this.config.spec.dimensions,this.config.data);var c=this.config.settings.log;this.config.settings.excludeNull&&this.addFilter({tag:"default",predicate:D.excludeNullValues(this.config.spec.dimensions,function(a){c([a,"point was excluded, because it has undefined values."],"WARN")})})},d.prototype.getConfig=function(){return this.config},d.prototype.setupMetaInfo=function(a,b){var c=a?a:D.autoDetectDimTypes(b);return D.autoAssignScales(c)},d.prototype.setupSettings=function(b){var c=d.globalSettings,e={};return Object.keys(c).forEach(function(b){e[b]=a.isFunction(c[b])?c[b]:y.clone(c[b])}),a.defaults(b||{},e)},d.prototype.insertToRightSidebar=function(a){return z.appendTo(a,this._layout.rightSidebar)},d.prototype.addBalloon=function(a){return new s("",a||{})},d.prototype.renderTo=function(c,d){this._renderGraph=null,this._svg=null,this._defaultSize=a.clone(d);var e=b.select(c),f=e.node();if(this._target=c,this._targetSizes=d,null===f)throw new Error("Target element not found");this._layout.content;f.appendChild(this._layout.layout),e=b.select(this._layout.content);var g=d||{};this._layout.content.innerHTML="",g.width&&g.height||(g=a.defaults(g,z.getContainerSize(this._layout.content.parentNode)));var h=this.getData();if(0===h.length)return void(this._layout.content.innerHTML=this._emptyContainer);this._targetSizes=g,this._layout.content.innerHTML="";var i=new B(this.config.spec.dimensions,h),j=a.find(this.config.settings.specEngine,function(a){return g.width<=a.width}),k=u.get(j.name,this.config.settings),l=k(this.config.spec,i.mix({})),m=F(l.unit),n=m.w,o=m.h,p=z.getScrollbarWidth(),q=g.width-n,s=g.height-o,t=q>=0?g.width:n,w=s>=0?0:p,y=s>=0?g.height:o,D=q>=0?0:p;g.height=y-D,g.width=t-w;var E=this.config.settings;G(i.mix({}),l.unit,g,E);var H=new r(i,C),I=this,J=H.buildGraph(l),K=v.get(this.config.settings.layoutEngine)(J),L=H.calcLayout(K,g),M=H.renderGraph(L,e.append("svg").attr("class",A+"svg").attr("width",g.width).attr("height",g.height),function(a){return I.fire("unitready",a)});this._renderGraph=L,this._svg=M.node(),M.selectAll(".i-role-datum").call(x(this)),this._layout.rightSidebar.style.maxHeight=g.height+"px",this.fire("render",this._svg)},d.prototype.getData=function(b){b=b||{};var c=a.chain(this._filtersStore.filters).values().flatten().reject(function(c){return a.contains(b.excludeFilter,c.tag)}).pluck("predicate").value();return a.filter(this.config.data,a.reduce(c,function(a,b){return function(c){return a(c)&&b(c)}},function(){return!0}))},d.prototype.setData=function(a){this.config.data=a,this.refresh()},d.prototype.getSVG=function(){return this._svg},d.prototype.addFilter=function(a){var b=a.tag,c=this._filtersStore.filters[b]=this._filtersStore.filters[b]||[],d=this._filtersStore.tick++;return a.id=d,c.push(a),this.refresh(),d},d.prototype.removeFilter=function(b){var c=this;a.each(this._filtersStore.filters,function(d,e){c._filtersStore.filters[e]=a.reject(d,function(a){return a.id===b})}),this.refresh()},d.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},d.prototype.resize=function(a){void 0===a&&(a={}),this.renderTo(this._target,a)},d.prototype.select=function(a){var b=[];if(!this._renderGraph)return b;var c=function(a,b){b(a),(a.childUnits||[]).forEach(function(a){return c(a,b)})};return c(this._renderGraph,function(c){a(c)&&b.push(c)}),b},d}(t);c.Plot=H}),e("charts/tau.chart",["exports","./tau.plot","../utils/utils","../data-processor"],function(b,c,d,e){function f(a,b,c){return b.reduce(function(b,d,e){var f=a[d];return f?b.status!=o.FAIL&&("measure"===f.type&&(b.countMeasureAxis++,b.indexMeasureAxis.push(e)),"measure"!==f.type&&1===b.countMeasureAxis?b.status=o.WARNING:b.countMeasureAxis>1&&(b.status=o.FAIL,b.messages.push('There are more then one measure dimensions for axis "'+c+'"'))):(b.status=o.FAIL,b.messages.push('Undefined dimension "'+d+'" for axis "'+c+'"')),b},{status:o.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[]})}function g(b,c){var d=m(c.x),e=m(c.y),g=f(c.dimensions,d,"x"),h=f(c.dimensions,e,"y");d=p[g.status](d,g),e=p[h.status](e,h);for(var i=m(c.guide),j=Math.max(d.length,e.length);i.length0;o--){var q=d.pop(),r=e.pop(),s=i.pop()||{};o===j?(k.x=q,k.y=r,k.unit.push(n(b,{x:l(q),y:l(r),color:c.color,size:c.size,flip:c.flip,colorGuide:s.color})),k.guide=a.defaults(s,{x:{label:q},y:{label:r}})):k={type:"COORDS.RECT",x:l(q),y:l(r),unit:[k],guide:a.defaults(s,{x:{label:q},y:{label:r}})}}return c.spec={dimensions:c.dimensions,unit:k},c}var h=function(a,b){a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),a.__proto__=b},i=c.Plot,j=d.utils,k=e.DataProcessor,l=function(a){return a?a:null},m=function(a){return j.isArray(a)?a:[a]},n=function(a,b){return{type:a,x:b.x,y:b.y,color:b.color,guide:{color:b.colorGuide},flip:b.flip,size:b.size}},o={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},p=function(b){return b[o.SUCCESS]=function(a){return a},b[o.FAIL]=function(a,b){throw new Error((b.messages||[]).join("\n")||"This configuration is not supported, See http://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart")},b[o.WARNING]=function(b,c){var d=b[c.indexMeasureAxis[0]],e=a.without(b,d);return e.push(d),e},b}({}),q={scatterplot:function(a){return g("ELEMENT.POINT",a)},line:function(b){var c=b.data,d=b.settings.log,e={none:function(){return null},horizontal:function(a){var b=j.isArray(a.x)?a.x:[a.x];return b[b.length-1]},vertical:function(a){var b=j.isArray(a.y)?a.y:[a.y];return b[b.length-1]},auto:function(a){var b,e=j.isArray(a.x)?a.x:[a.x],f=j.isArray(a.y)?a.y:[a.y],g=e[e.length-1],h=e.slice(0,e.length-1),i=f[f.length-1],l=f.slice(0,f.length-1),m=a.color,n=h.concat(l).concat([m]).filter(function(a){return null!==a}),o=-1,p=[[[g].concat(n),i],[[i].concat(n),g]],q=p.some(function(a,b){var e=a[0],f=a[1],g=k.isYFunctionOfX(c,e,[f]);return g.result?o=b:d(["Attempt to find a functional relation between",a[0]+" and "+a[1]+" is failed.","There are several "+g.error.keyY+" values (e.g. "+g.error.errY.join(",")+")","for ("+g.error.keyX+" = "+g.error.valX+")."].join(" ")),g.result});return q?b=p[o][0][0]:(d(["All attempts are failed.","Will orient line horizontally by default.","NOTE: the [scatterplot] chart is more convenient for that data."].join(" ")),b=g),b}},f=(b.lineOrientation||"auto").toLowerCase(),h=e.hasOwnProperty(f)?e[f]:e.auto,i=h(b);return null!==i&&(b.data=a(c).sortBy(i)),g("ELEMENT.LINE",b)},bar:function(a){return a.flip=!1,g("ELEMENT.INTERVAL",a)},horizontalBar:function(a){return a.flip=!0,g("ELEMENT.INTERVAL",a)}},r=function(b){var c=function d(c){c=a.defaults(c,{autoResize:!0}),c.autoResize&&d.winAware.push(this),c.settings=this.setupSettings(c.settings),c.dimensions=this.setupMetaInfo(c.dimensions,c.data);var e=q[c.type];if(!a.isFunction(e))throw new Error("Chart type "+c.type+" is not supported. Use one of "+a.keys(q).join(", ")+".");b.call(this,e(c))};return h(c,b),c.prototype.destroy=function(){var a=c.winAware.indexOf(this);-1!==a&&c.winAware.splice(a,1),b.prototype.destroy.call(this)},c}(i);r.resizeOnWindowEvent=function(){function a(){!c&&r.winAware.length&&(c=d(b))}function b(){c=0;for(var a,b=0,d=r.winAware.length;d>b;b++)a=r.winAware[b],a.resize()}var c,d=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(a){return setTimeout(a,17)};return a}(),r.winAware=[],window.addEventListener("resize",r.resizeOnWindowEvent),b.Chart=r}),e("elements/coords",["exports","../utils/utils-draw","../const","../utils/utils","../matrix"],function(b,c,d,e,f){var g=c.utilsDraw,h=d.CSS_PREFIX,i=e.utils,j=f.TMatrix,k={CROSS:function(b,c,d){var e=b.domain(c),f=b.domain(d).reverse();return a(f).map(function(b){return a(e).map(function(a){var e={};return c&&(e[c]=a),d&&(e[d]=b),e})})}},l=function(a){return k[a]||function(){return[[{}]]}},m=function(b,c,d){var e=a.defaults(i.clone(b),a.pick.apply(a,[c].concat(d)));return e.guide=a.extend(i.clone(c.guide),e.guide),e},n={walk:function(b,c){var d=a.defaults(b,{$where:{}}),e=a.any(d.unit,function(a){return 0===a.type.indexOf("COORDS.")}),f=l(e?"CROSS":""),g=new j(f(d,d.x,d.y)),h=new j(g.sizeR(),g.sizeC());return g.iterate(function(b,c,e){var f=a.extend({},d.$where,e),g=a(d.unit).map(function(b){return a.extend(m(b,d,["x","y"]),{$where:f})});h.setRC(b,c,g)}),d.$matrix=h,h.iterate(function(b,d,e){a.each(e,function(a){return c(a)})}),d},draw:function(a){var b=a.options,c=a.guide.padding;a.x.guide=a.guide.x,a.y.guide=a.guide.y;var d=b.left+c.l,e=b.top+c.t,f=b.width-(c.l+c.r),i=b.height-(c.t+c.b);a.x.scaleObj=a.x.scaleDim&&a.scaleTo(a.x.scaleDim,[0,f],a.x.guide),a.y.scaleObj=a.y.scaleDim&&a.scaleTo(a.y.scaleDim,[i,0],a.y.guide),a.x.guide.size=f,a.y.guide.size=i;var j=[0,i+a.guide.x.padding],k=[0-a.guide.y.padding,0],l=b.container.append("g").attr("class",h+"cell cell").attr("transform",g.translate(d,e)).datum({$where:a.$where});return a.x.guide.hide||g.fnDrawDimAxis.call(l,a.x,j,f),a.y.guide.hide||g.fnDrawDimAxis.call(l,a.y,k,i),g.fnDrawGrid.call(l,a,i,f)}};b.coords=n}),e("utils/css-class-map",["exports","../const"],function(a,b){function c(a){return g[a-1]||g[4]}function d(a){var b=0;return a>=160&&320>a?b=1:a>=320&&480>a?b=2:a>=480&&640>a?b=3:a>=640&&(b=4),h[b]}var e=b.CSS_PREFIX,f=[1,2,3,4,5],g=f.map(function(a){return e+"line-opacity-"+a}),h=f.map(function(a){return e+"line-width-"+a});a.getLineClassesByWidth=d,a.getLineClassesByCount=c}),e("elements/line",["exports","../const","../utils/css-class-map"],function(a,c,d){var e=c.CSS_PREFIX,f=d.getLineClassesByWidth,g=d.getLineClassesByCount,h=function(a){var c=a.options,d=c.xScale,h=c.yScale,i=c.color,j=a.groupBy(a.partition(),i.dimension),k=f(c.width),l=g(j.length),m=function(){this.attr("class",function(a){return""+e+"line i-role-element i-role-datum line "+i.get(a.key)+" "+k+" "+l});var a=this.selectAll("path").data(function(a){return[a.values]});a.call(p),a.enter().append("path").call(p),a.exit().remove()},n=function(b){var f=function(){return this.attr("r",1.5).attr("class",function(a){return""+e+"dot-line dot-line i-role-element "+e+"dot i-role-datum "+i.get(a[i.dimension])}).attr("cx",function(b){return d(b[a.x.scaleDim])}).attr("cy",function(b){return h(b[a.y.scaleDim])})},g=c.container.selectAll(".dot-line").data(b);g.call(f),g.exit().remove(),g.enter().append("circle").call(f)},o=b.svg.line().x(function(b){return d(b[a.x.scaleDim])}).y(function(b){return h(b[a.y.scaleDim])}),p=function(){this.attr("d",o)},q=j.reduce(function(a,b){var c=b.values;return 1===c.length&&a.push(c[0]),a},[]);q.length>0&&n(q);var r=c.container.selectAll(".line").data(j);r.call(m),r.enter().append("g").call(m),r.exit().remove()};a.line=h}),e("elements/point",["exports","../const"],function(a,b){var c=b.CSS_PREFIX,d=function(a){var b=a.options,d=b.xScale,e=b.yScale,f=b.color,g=b.sizeScale,h=function(){return this.attr("r",function(b){return g(b[a.size.scaleDim])}).attr("cx",function(b){return d(b[a.x.scaleDim])}).attr("cy",function(b){return e(b[a.y.scaleDim])}).attr("class",function(a){return""+c+"dot dot i-role-element i-role-datum "+f.get(a[f.dimension])})},i=b.container.selectAll(".dot").data(a.partition());i.call(h),i.exit().remove(),i.enter().append("circle").call(h)};a.point=d}),e("elements/interval",["exports","../utils/utils-draw","../const"],function(a,b,c){var d=function(a){return Array.isArray(a)?a:Array.from(a)},e=b.utilsDraw,f=c.CSS_PREFIX,g="i-role-bar-group",h=function(a){return"measure"===a.dimType},i=function(a){var b=a.size/a.domain().length,c=b/(a.categories.length+1);return{tickWidth:b,intervalWidth:c,offsetCategory:c}},j={NORM:function(a,b,c,f,g,j,k){var l=1,m=Math.min.apply(Math,d(c.domain())),n=!isNaN(m),o=!n||0>=m?0:m,p=h(a.x),q=p?k:i({domain:b.domain,categories:j,size:f}),r=q.tickWidth,s=q.intervalWidth,t=q.offsetCategory,u=function(c){return b(c[a.x.scaleDim])-r/2},v=n?function(b){var d=b[a.y.scaleDim],e=c(Math.max(o,d)),f=Math.abs(c(d)-c(o)),g=l>f;return g&&d>0?e-l:e}:function(b){return c(b[a.y.scaleDim])},w=function(){return s},x=n?function(b){var d=b[a.y.scaleDim],e=Math.abs(c(d)-c(o));return 0===d?e:Math.max(l,e)}:function(b){return g-c(b[a.y.scaleDim])},y=function(a,b){return e.translate(b*t+t/2,0)};return{calculateX:u,calculateY:v,calculateWidth:w,calculateHeight:x,calculateTranslate:y}},FLIP:function(a,b,c,f,g,j,k){var l=1,m=Math.min.apply(Math,d(b.domain())),n=!isNaN(m),o=!n||0>=m?0:m,p=h(a.y),q=p?k:i({domain:c.domain,categories:j,size:g}),r=q.tickWidth,s=q.intervalWidth,t=q.offsetCategory,u=n?function(c){var d=c[a.x.scaleDim],e=Math.abs(b(d)-b(o)),f=b(Math.min(o,d)),g=e-l,h=d>0?l+g:0>d?0-l:0,i=0>g;return i?f+h:f}:0,v=function(b){return c(b[a.y.scaleDim])-r/2},w=n?function(c){var d=c[a.x.scaleDim],e=Math.abs(b(d)-b(o));return 0===d?e:Math.max(l,e)}:function(c){return b(c[a.x.scaleDim])},x=function(){return s},y=function(a,b){return e.translate(0,b*t+t/2)};return{calculateX:u,calculateY:v,calculateWidth:w,calculateHeight:x,calculateTranslate:y}}},k=function(a){var b=a.options,c=b.xScale,d=b.yScale,e=b.color,h=a.groupBy(a.partition(),e.dimension),i=j[a.flip?"FLIP":"NORM"],k=i(a,c,d,b.width,b.height,h,{tickWidth:5,intervalWidth:5,offsetCategory:0}),l=k.calculateX,m=k.calculateY,n=k.calculateWidth,o=k.calculateHeight,p=k.calculateTranslate,q=function(){return this.attr("height",o).attr("width",n).attr("class",function(a){return"i-role-element i-role-datum bar "+f+"bar "+e.get(a[e.dimension])}).attr("x",l).attr("y",m)},r=function(){this.attr("class",g).attr("transform",p);var a=this.selectAll("bar").data(function(a){return a.values});a.call(q),a.enter().append("rect").call(q),a.exit().remove()},s=b.container.selectAll("."+g).data(h);s.call(r),s.enter().append("g").call(r),s.exit().remove()};a.interval=k}),e("elements/coords-parallel",["exports","../utils/utils-draw","../const","../utils/utils","../matrix"],function(c,d,e,f,g){var h=d.utilsDraw,i=(e.CSS_PREFIX,f.utils),j=g.TMatrix,k=function(b,c,d){var e=a.defaults(i.clone(b),a.pick.apply(a,[c].concat(d)));return e.guide=a.extend(i.clone(c.guide||{}),e.guide||{}),e},l={walk:function(b,c){var d=a.defaults(b,{$where:{}}),e=new j(1,1),f=new j(1,1);return e.iterate(function(b,c){var e=a.extend({},d.$where),g=a(d.unit).map(function(b){return a.extend(k(b,d,["x"]),{$where:e})});f.setRC(b,c,g)}),d.$matrix=f,f.iterate(function(b,d,e){a.each(e,function(a){return c(a)})}),d},draw:function(a){var c=a.options,d=a.guide.padding,e=c.left+d.l,f=c.top+d.t,g=c.width-(d.l+d.r),i=c.height-(d.t+d.b),j=a.x.map(function(b){return a.scaleTo(b,[i,0],{})}),k=c.container.append("g").attr("class","graphical-report__cell cell").attr("transform",h.translate(e,f)),l=function(a,b){return"translate("+a+","+b+")"},m=function(a){return"rotate("+a+")"},n=function(a,c){var d=this,e=b.svg.axis().scale(a).orient("left"),f=d.append("g").attr("class","y axis").attr("transform",l.apply(null,c)).call(e);f.selectAll(".tick text").attr("transform",m(0)).style("text-anchor","end")},o=g/(a.x.length-1);return j.forEach(function(a,b){n.call(k,a,[b*o,0])}),k.append("g").attr("class","grid").attr("transform",l(0,0))}};c.CoordsParallel=l}),e("elements/coords-parallel-line",["exports","../utils/utils-draw","../const"],function(a,c,d){var e=c.utilsDraw,f=(d.CSS_PREFIX,{draw:function(a){a.color=a.dimension(a.color,a);var c=a.options,d=a.x.reduce(function(b,d){return b[d]=a.scaleTo(d,[c.height,0],{}),b},{}),f=e.generateColor(a),g=b.nest().key(function(a){return a[f.dimension]}).entries(a.partition()).map(function(b){var c=b.values[0],d=[];return a.x.forEach(function(a){d.push({key:a,val:c[a]})}),d}),h=function(){this.attr("class",function(){return"graphical-report__line line color10-9"});var a=this.selectAll("path").data(function(a){return[a]});a.call(l),a.enter().append("path").call(l),a.exit().remove()},i=c.width/(a.x.length-1),j={};a.x.forEach(function(a,b){j[a]=b*i});var k=b.svg.line().x(function(a){return j[a.key]}).y(function(a){return d[a.key](a.val)}),l=function(){this.attr("d",k)},m=c.container.selectAll(".line").data(g);m.call(h),m.enter().append("g").call(h),m.exit().remove()}});a.CoordsParallelLine=f}),e("elements/size",["exports"],function(b){var c=function(a){return Math.sqrt(a)},d=function(b,d,e,f){var g=a.filter(b,a.isFinite);if(0===g.length)return function(){return f};var h=1,i=0,j=Math.min.apply(null,g),k=Math.max.apply(null,g),l=c(Math.max.apply(null,[Math.abs(j),Math.abs(k),k-j]));return i=0>j?j:0,h=0===l?1:(e-d)/l,function(b){var f=null!==b?parseFloat(b):0;if(!a.isFinite(f))return e;var g=f-i;return d+c(g)*h}};b.sizeScale=d}),e("node-map",["exports","./elements/coords","./elements/line","./elements/point","./elements/interval","./utils/utils-draw","./elements/coords-parallel","./elements/coords-parallel-line","./elements/size"],function(b,c,d,e,f,g,h,i,j){var k=c.coords,l=d.line,m=e.point,n=f.interval,o=g.utilsDraw,p=h.CoordsParallel,q=i.CoordsParallelLine,r=j.sizeScale,s=function(b,c){c.forEach(function(a){b[a]=b.dimension(b[a],b)});var d=b.options,e=d.width,f=d.height;if(b.x.guide=b.guide.x,b.y.guide=b.guide.y,b.options.xScale=b.x.scaleDim&&b.scaleTo(b.x.scaleDim,[0,e],b.x.guide),b.options.yScale=b.y.scaleDim&&b.scaleTo(b.y.scaleDim,[f,0],b.y.guide),b.options.color=o.generateColor(b),b.size){var g=.5*a.min([b.guide.x.tickFontHeight,b.guide.y.tickFontHeight].filter(function(a){return 0!==a})),h=.5*a.min([b.guide.x.density,b.guide.y.density].filter(function(a){return 0!==a}));b.options.sizeScale=r(b.domain(b.size.scaleDim),2,h,g)}return b},t={"COORDS.RECT":{walk:k.walk,draw:function(a,b){return a.x=a.dimension(a.x,a),a.y=a.dimension(a.y,a),k.draw(a,b)}},"ELEMENT.POINT":function(a){return m(s(a,["x","y","color","size"]))},"ELEMENT.LINE":function(a){return l(s(a,["x","y","color"]))},"ELEMENT.INTERVAL":function(a){return n(s(a,["x","y","color"]))},"COORDS.PARALLEL":p,"PARALLEL/ELEMENT.LINE":q};b.nodeMap=t}),e("tau.newCharts",["exports","./utils/utils-dom","./charts/tau.plot","./charts/tau.chart","./unit-domain-mixin","./unit-domain-period-generator","./dsl-reader","./spec-engine-factory","./layout-engine-factory","./formatter-registry","./node-map","./units-registry"],function(c,d,e,f,g,h,i,j,k,l,m,n){var o=d.utilsDom,p=e.Plot,q=f.Chart,r=g.UnitDomainMixin,s=h.UnitDomainPeriodGenerator,t=i.DSLReader,u=j.SpecEngineFactory,v=k.LayoutEngineFactory,w=l.FormatterRegistry,x=m.nodeMap,y=n.UnitsRegistry,z={},A={},B={UnitDomainMixin:r,UnitDomainPeriodGenerator:s,DSLReader:t,SpecEngineFactory:u,LayoutEngineFactory:v},C={UnitsRegistry:y,tickFormat:w,d3:b,_:a,tickPeriod:s,colorBrewers:{add:function(a,b){a in z||(z[a]=b)},get:function(a){return z[a]}},plugins:{add:function(a,b){if(a in A)throw new Error("Plugins is already registred.");A[a]=b},get:function(a){return A[a]}},globalSettings:{log:function(a,b){b=b||"INFO",Array.isArray(a)||(a=[a]),console[b.toLowerCase()].apply(console,a)},excludeNull:!0,specEngine:[{name:"COMPACT",width:600},{name:"AUTO",width:Number.MAX_VALUE}],layoutEngine:"EXTRACT",getAxisTickLabelSize:o.getAxisTickLabelSize,xAxisTickLabelLimit:100,yAxisTickLabelLimit:100,xTickWordWrapLinesLimit:2,yTickWordWrapLinesLimit:2,xTickWidth:9,yTickWidth:9,distToXAxisLabel:20,distToYAxisLabel:20,xAxisPadding:20,yAxisPadding:20,xFontLabelHeight:10,yFontLabelHeight:10,xDensityPadding:4,yDensityPadding:4,"xDensityPadding:measure":8,"yDensityPadding:measure":8,defaultFormats:{measure:"x-num-auto","measure:time":"x-time-auto","measure:time:year":"year","measure:time:quarter":"quarter","measure:time:month":"month","measure:time:week":"x-time-auto","measure:time:day":"x-time-auto","measure:time:hour":"x-time-auto","measure:time:min":"x-time-auto","measure:time:sec":"x-time-auto","measure:time:ms":"x-time-auto"}}};p.globalSettings=C.globalSettings,C.UnitsRegistry.add("COORDS.PARALLEL",x["COORDS.PARALLEL"]).add("PARALLEL/ELEMENT.LINE",x["PARALLEL/ELEMENT.LINE"]).add("COORDS.RECT",x["COORDS.RECT"]).add("ELEMENT.POINT",x["ELEMENT.POINT"]).add("ELEMENT.LINE",x["ELEMENT.LINE"]).add("ELEMENT.INTERVAL",x["ELEMENT.INTERVAL"]),c.Plot=p,c.Chart=q,c.__api__=B,c.api=C}),e("underscore",function(){return a -}),e("d3",function(){return b}),d("tau.newCharts")}),function(a){if("function"==typeof define&&define.amd)define(["tauCharts"],function(b){return a(b)});else if("object"==typeof module&&module.exports){{require("tauCharts")}module.exports=a()}else a(this.tauCharts)}(function(a){var b=function(a){if(a.color)return a;var c,d,e,f=a.unit||[];for(c=0;c',_template:c.template('
<%=name%>
<%=items%>'),_itemTemplate:c.template(["
\">",'
<%=label%>',"
"].join("")),onRender:function(a){if(this._container){var d=this._unit.options.color,e=d.dimension,f=this._getColorMap(a,d,e),g=a.getConfig(),h=b(g.spec.unit);h.guide=h.guide||{},h.guide.color=this._unit.guide.color,h.guide.color.brewer=f;var i=c.map(f,function(a,b){var d=JSON.stringify({dimension:e,value:b,color:a});return this._itemTemplate({color:a,classDisabled:this._currentFilters[d]?"disabled":"",label:c.escape(b),value:d})},this).join("");this._container.innerHTML=this._template({items:i,name:this._unit.guide.color.label.text||this._unit.options.color.dimension})}}}};return a.api.plugins.add("legend",e),e}),function(a){if("function"==typeof define&&define.amd)define(["tauCharts"],function(b){return a(b)});else if("object"==typeof module&&module.exports){{require("tauCharts")}module.exports=a()}else a(this.tauCharts)}(function(a){function b(a){return a=a||{},{template:['
','
','
','Exclude',"
","
"].join(""),itemTemplate:['
','
<%=label%>
','
<%=value%>
',"
"].join(""),onExcludeData:function(){},_drawPoint:function(a,b,c,d){this.circle&&this.circle.remove(),this.circle=a.append("circle").attr("cx",b).attr("cy",c).attr("class",d).attr("r",4),this.circle.node().addEventListener("mouseover",function(){clearTimeout(this._timeoutHideId)}.bind(this),!1),this.circle.node().addEventListener("mouseleave",function(){this._hide()}.bind(this),!1)},formatters:{},_getFormatter:function(a){return this.formatters[a]||c.identity},init:function(b){this._chart=b,this._dataFields=a.fields,this._getDataFields=a.getFields,c.extend(this,c.omit(a,"fields","getFields")),this._timeoutHideId=null,this._dataWithCoords={},this._unitMeta={},this._templateItem=c.template(this.itemTemplate),this._tooltip=b.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._elementTooltip=this._tooltip.getElement();var d=this._elementTooltip;d.addEventListener("mouseover",function(){clearTimeout(this._timeoutHideId)}.bind(this),!1),d.addEventListener("mouseleave",function(){this._hide()}.bind(this),!1),d.addEventListener("click",function(a){for(var b=a.target;b!==a.currentTarget&&null!==b;)b.classList.contains("i-role-exclude")&&(this._exclude(),this._hide()),b=b.parentNode}.bind(this),!1),d.insertAdjacentHTML("afterbegin",this.template)},onUnitReady:function(a,b){if(b.type&&0===b.type.indexOf("ELEMENT")){var c=this._generateKey(b.$where);this._unitMeta[c]=b;var d=b.partition();this._dataWithCoords[c]=d.map(function(a){return{x:b.options.xScale(a[b.x.scaleDim]),y:b.options.yScale(a[b.y.scaleDim]),item:a}},this)}},render:function(a,b){return b=c.unique(b),b.map(function(b){var d=a[b],e=c.isNull(d)||c.isUndefined(d)?"No "+b:d;return this._templateItem({label:b,value:this._getFormatter(b)(e)})},this).join("")},onRender:function(a){c.isFunction(this._getDataFields)&&(this._dataFields=this._getDataFields(a)),this._hide()},_exclude:function(){this._chart.addFilter({tag:"exclude",predicate:function(a){return function(b){return JSON.stringify(b)!==JSON.stringify(a)}}(this._currentElement)}),this.onExcludeData(this._currentElement)},_calculateLength:function(a,b,c,d){return(c-a)*(c-a)+(d-b)*(d-b)},_calculateLengthToLine:function(a,b,c,d,f,g){var h={x:c-a,y:d-b},i={x:f-a,y:g-b},j=h.x*i.x+h.y*i.y;if(0>j)return e(a,f,b,g);var k={x:a-c,y:b-d},l={x:f-c,y:g-d},m=k.x*l.x+k.y*l.y;return 0>m?e(c,f,d,g):Math.abs(((c-a)*(g-b)-(d-b)*(f-a))/e(a,c,b,d))},_generateKey:function(a){return JSON.stringify(a)},_getFields:function(a){if(this._dataFields)return this._dataFields;for(var b=[a.size&&a.size.scaleDim,a.color&&a.color.scaleDim],d=[],e=[];a=a.parentUnit;)d.push(a.x.scaleDim),e.push(a.y.scaleDim);return c.compact(b.concat(e,d).reverse())},isLine:function(a){return a.elementData.key&&Array.isArray(a.elementData.values)},_onElementMouseOver:function(a,b,e,f){clearTimeout(this._timeoutHideId);var g=this._generateKey(b.cellData.$where),h=b.elementData,i=this.isLine(b);if(i){var j=this._dataWithCoords[g],k=j.filter(function(a){return c.contains(h.values,a.item)}),l=c.reduce(k,function(a,b,c,d){var f;if(c+1===d.length){var g=b;b=d[c-1],f=g}else f=d[c+1];var h=this._calculateLengthToLine(b.x,b.y,f.x,f.y,e[0],e[1]);return h1&&f("i-trendline-"+e,n,j.xScale,j.yScale,j.color.get(g),j.container)});var r=function(a){return function(){var b=e.select(this);b.classed({active:a,"graphical-report__line-width-1":!a,"graphical-report__line-width-2":a})}};j.container.selectAll(".graphical-report__trendline").on("mouseenter",r(!0)).on("mouseleave",r(!1))}},containerTemplate:'
',template:d.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(){if(this._container){var a=this.isApplicable?"applicable-true":"applicable-false",c=this.isApplicable?"applicable-false":"applicable-true";this._container.classList.add(a),this._container.classList.remove(c),this._container.innerHTML=this.template({title:"Trend line",error:this.error,showTrend:b.showTrend&&this.isApplicable?"checked":"",models:["linear","exponential","logarithmic"].map(function(a){var c=b.type===a?"selected":"";return""})})}}}}var c=function(){"use strict";var a=function(a,b){var c=0,d=0,e=0,f=0,g=0,h=a.length-1,i=new Array(b);for(c=0;h>c;c++){for(f=c,d=c+1;h>d;d++)Math.abs(a[c][d])>Math.abs(a[c][f])&&(f=d);for(e=c;h+1>e;e++)g=a[e][c],a[e][c]=a[e][f],a[e][f]=g;for(d=c+1;h>d;d++)for(e=h;e>=c;e--)a[e][d]-=a[e][c]*a[c][d]/a[c][c]}for(d=h-1;d>=0;d--){for(g=0,e=d+1;h>e;e++)g+=a[e][d]*i[e];i[d]=(a[h][d]-g)/a[d][d]}return i},b={linear:function(a){for(var b=[0,0,0,0,0],c=0,d=[];cg;g++){var i=[a[g][0],a[g][0]*e+f];d.push(i)}var j="y = "+Math.round(100*e)/100+"x + "+Math.round(100*f)/100;return{equation:[e,f],points:d,string:j}},exponential:function(a){var b=[0,0,0,0,0,0],c=0,d=[];for(i=a.length;i>c;c++)a[c][1]&&(b[0]+=a[c][0],b[1]+=a[c][1],b[2]+=a[c][0]*a[c][0]*a[c][1],b[3]+=a[c][1]*Math.log(a[c][1]),b[4]+=a[c][0]*a[c][1]*Math.log(a[c][1]),b[5]+=a[c][0]*a[c][1]);for(var e=b[1]*b[2]-b[5]*b[5],f=Math.pow(Math.E,(b[2]*b[3]-b[5]*b[4])/e),g=(b[1]*b[4]-b[5]*b[3])/e,h=0,i=a.length;i>h;h++){var j=[a[h][0],f*Math.pow(Math.E,g*a[h][0])];d.push(j)}var k="y = "+Math.round(100*f)/100+"e^("+Math.round(100*g)/100+"x)";return{equation:[f,g],points:d,string:k}},logarithmic:function(a){var b=[0,0,0,0],c=0,d=[];for(h=a.length;h>c;c++)a[c][1]&&(b[0]+=Math.log(a[c][0]),b[1]+=a[c][1]*Math.log(a[c][0]),b[2]+=a[c][1],b[3]+=Math.pow(Math.log(a[c][0]),2));for(var e=(c*b[1]-b[2]*b[0])/(c*b[3]-b[0]*b[0]),f=(b[2]-e*b[0])/c,g=0,h=a.length;h>g;g++){var i=[a[g][0],f+e*Math.log(a[g][0])];d.push(i)}var j="y = "+Math.round(100*f)/100+" + "+Math.round(100*e)/100+" ln(x)";return{equation:[f,e],points:d,string:j}},power:function(a){var b=[0,0,0,0],c=0,d=[];for(h=a.length;h>c;c++)a[c][1]&&(b[0]+=Math.log(a[c][0]),b[1]+=Math.log(a[c][1])*Math.log(a[c][0]),b[2]+=Math.log(a[c][1]),b[3]+=Math.pow(Math.log(a[c][0]),2));for(var e=(c*b[1]-b[2]*b[0])/(c*b[3]-b[0]*b[0]),f=Math.pow(Math.E,(b[2]-e*b[0])/c),g=0,h=a.length;h>g;g++){var i=[a[g][0],f*Math.pow(a[g][0],e)];d.push(i)}var j="y = "+Math.round(100*f)/100+"x^"+Math.round(100*e)/100;return{equation:[f,e],points:d,string:j}},polynomial:function(b,c){"undefined"==typeof c&&(c=2);for(var d=[],e=[],f=[],g=0,h=0,i=0,j=c+1;j>i;i++){for(var k=0,l=b.length;l>k;k++)b[k][1]&&(g+=Math.pow(b[k][0],i)*b[k][1]);d.push(g),g=0;for(var m=[],n=0;j>n;n++){for(var k=0,l=b.length;l>k;k++)b[k][1]&&(h+=Math.pow(b[k][0],i+n));m.push(h),h=0}e.push(m)}e.push(d);for(var o=a(e,j),i=0,l=b.length;l>i;i++){for(var p=0,q=0;q=0;i--)r+=i>1?Math.round(100*o[i])/100+"x^"+i+" + ":1==i?Math.round(100*o[i])/100+"x + ":Math.round(100*o[i])/100;return{equation:o,points:f,string:r}},lastvalue:function(a){for(var b=[],c=null,d=0;d1?0:m,e=c>1?m:0;return a.guide.x.padding+=i.paddings[c].b,a.guide.y.padding+=i.paddings[c].l,a.guide.x.padding-=e,a.guide.y.padding-=e,a.guide.padding.l=d,a.guide.padding.b=d,a.guide.padding.r=d,a.guide.padding.t=d,a}),n}},j={get:function(a){return i[a]||i.NONE}};a.LayoutEngineFactory=j}),e("plugins",["exports"],function(a){var c=function(){var a=function(a,b){this.chart=b,this._plugins=a.map(this.initPlugin,this)};return a.prototype.initPlugin=function(a){var b=this;a.init&&a.init(this.chart),this.chart.on("destroy",a.destroy&&a.destroy.bind(a)||function(){}),Object.keys(a).forEach(function(c){if(0===c.indexOf("on")){var d=c.substr(2);b.chart.on(d.toLowerCase(),a[c].bind(a))}})},a}(),d=["click","mouseover","mouseout","mousemove"],e=function(a){return function(){d.forEach(function(c){this.on(c,function(d){a.fire("element"+c,{elementData:d,element:this,cellData:b.select(this.parentNode.parentNode).datum()})})},this)}};a.propagateDatumEvents=e,a.Plugins=c}),e("unit-domain-period-generator",["exports"],function(a){var b={day:{cast:function(a){return new Date(a.setHours(0,0,0,0))},next:function(a){return new Date(a.setDate(a.getDate()+1))}},week:{cast:function(a){return a=new Date(a.setHours(0,0,0,0)),a=new Date(a.setDate(a.getDate()-a.getDay()))},next:function(a){return new Date(a.setDate(a.getDate()+7))}},month:{cast:function(a){return a=new Date(a.setHours(0,0,0,0)),a=new Date(a.setDate(1))},next:function(a){return new Date(a.setMonth(a.getMonth()+1))}},quarter:{cast:function(a){a=new Date(a.setHours(0,0,0,0)),a=new Date(a.setDate(1));var b=a.getMonth(),c=b-b%3;return new Date(a.setMonth(c))},next:function(a){return new Date(a.setMonth(a.getMonth()+3))}},year:{cast:function(a){return a=new Date(a.setHours(0,0,0,0)),a=new Date(a.setDate(1)),a=new Date(a.setMonth(0))},next:function(a){return new Date(a.setFullYear(a.getFullYear()+1))}}},c={add:function(a,c){return b[a.toLowerCase()]=c,this},get:function(a){return b[a.toLowerCase()]},generate:function(a,c,d){var e=[],f=b[d.toLowerCase()];if(f){var g=f.cast(new Date(c)),h=f.cast(new Date(a));for(e.push(h);(h=f.next(new Date(h)))<=g;)e.push(h)}return e}};a.UnitDomainPeriodGenerator=c}),e("unit-domain-mixin",["exports","./unit-domain-period-generator","./utils/utils","underscore","d3"],function(a,b,c,d,e){var f=b.UnitDomainPeriodGenerator,g=c.utils,h=d,i=e,j={ordinal:function(a){return a},linear:function(a,b){var c=b.autoScale?g.autoScale(a):i.extent(a),d=h.isNumber(b.min)?b.min:c[0],e=h.isNumber(b.max)?b.max:c[1];return[Math.min(d,c[0]),Math.max(e,c[1])]},period:function(a,b){var c=i.extent(a),d=h.isNull(b.min)||h.isUndefined(b.min)?c[0]:new Date(b.min).getTime(),e=h.isNull(b.max)||h.isUndefined(b.max)?c[1]:new Date(b.max).getTime(),g=[new Date(Math.min(d,c[0])),new Date(Math.max(e,c[1]))];return f.generate(g[0],g[1],b.period)},time:function(a,b){var c=i.extent(a),d=h.isNull(b.min)||h.isUndefined(b.min)?c[0]:new Date(b.min).getTime(),e=h.isNull(b.max)||h.isUndefined(b.max)?c[1]:new Date(b.max).getTime();return[new Date(Math.min(d,c[0])),new Date(Math.max(e,c[1]))]}},k={ordinal:function(a,b){return i.scale.ordinal().domain(a).rangePoints(b,1)},linear:function(a,b){return i.scale.linear().domain(a).rangeRound(b,1)},period:function(a,b){return i.scale.ordinal().domain(a).rangePoints(b,1)},time:function(a,b){return i.time.scale().domain(a).range(b)}},l=function(){var a=function(a,b){var c=function(a){return function(b){var c=b||{};return c.hasOwnProperty(a)?c[a]:null}},d=function(b){var d=a[b]||{},e=d.value?c(d.value):function(a){return a},f=h.contains(["period","time"],d.scale);return f?h.compose(function(a){return new Date(a).getTime()},e):e},e=function(b){var c=a[b]||{};return c.order||null},g=function(a){var b={category:function(a,b,c){return c},order:function(a,b,c){var d=e(a);return d?h.union(d,c):h.sortBy(c,b)},measure:function(a,b,c){return h.sortBy(c,b)},"as-is":function(a,b,c){return c}};return b[a]||b["as-is"]},i=function(a){var b={category:g("category"),order:g("order"),measure:g("measure"),"as-is":g("as-is")};return b[a]||b["as-is"]};this.fnDimension=function(b,c){var d=(c||{}).dimensions||{},e=a[b]||{},f=d[b]||{};return{scaleDim:b,scaleType:f.scale||e.scale,dimType:f.type||e.type}},this.fnSource=function(a){var c=h.map(a,function(a,b){return function(c){return d(b)(c[b])===a}});return h(b).filter(function(a){return h.every(c,function(b){return b(a)})})};var l=function(c,e){if(!a[c])return[];var f=d(c),g=h(b).chain().pluck(c).uniq(f).value();return e(c,f,g)};this.fnDomain=function(b){var c=d(b),e=(a[b]||{}).type,f=l(b,g(e));return f.map(c)};var m=function(b,e){var g={},k=e||{};g.map=k.hasOwnProperty("map")?k.map:k.tickLabel,g.min=k.hasOwnProperty("min")?k.min:k.tickMin,g.max=k.hasOwnProperty("max")?k.max:k.tickMax,g.period=k.hasOwnProperty("period")?k.period:k.tickPeriod,g.autoScale=k.autoScale;var m=h.defaults({},a[b]),n={"order:period":function(a){return function(b){return f.get(a.period).cast(new Date(b))}},"*":function(){return function(a){return a}}},o=g.map?c(g.map):d(b),p=[m.type,m.scale].join(":"),q=(n[p]||n["*"])(g),r=l(b,i(m.type)).map(o),s=m.scale?j[m.scale](r,g):[];return{extract:function(a){return q(o(a))},values:s,source:r}};this.fnScaleMeta=m,this.fnScaleTo=function(b,c,d){var e=d||{},f=h.defaults({},a[b]),g=m(b,d),i=k[f.scale](g.values,c,e),j=function(a){return i(g.extract(a))};return Object.keys(i).forEach(function(a){return j[a]=i[a]}),j}};return a.prototype.mix=function(a){return a.dimension=this.fnDimension,a.source=this.fnSource,a.domain=this.fnDomain,a.scaleMeta=this.fnScaleMeta,a.scaleTo=this.fnScaleTo,a.partition=function(){return a.data||a.source(a.$where)},a.groupBy=function(a,b){return i.nest().key(function(a){return a[b]}).entries(a)},a},a}();a.UnitDomainMixin=l}),e("units-registry",["exports"],function(a){var b={},c={add:function(a,c){var d={};return d.draw="function"==typeof c?c:c.draw,d.walk=c.walk||function(a){return a},b[a]=d,this},get:function(a){if(!b.hasOwnProperty(a))throw new Error("Unknown unit type: "+a);return b[a]}};a.UnitsRegistry=c}),e("data-processor",["exports","./utils/utils"],function(b,c){var d=c.utils,e={isYFunctionOfX:function(a,b,c){var d=!0,e=null;try{a.reduce(function(a,d){var f=function(a,b){return a.push(d[b]),a},g=b.reduce(f,[]).join("/"),h=c.reduce(f,[]).join("/");if(a.hasOwnProperty(g)){var i=a[g];if(i!==h)throw e={type:"RelationIsNotAFunction",keyX:b.join("/"),keyY:c.join("/"),valX:g,errY:[i,h]},new Error("RelationIsNotAFunction")}else a[g]=h;return a},{})}catch(f){if("RelationIsNotAFunction"!==f.message)throw f;d=!1}return{result:d,error:e}},excludeNullValues:function(a,b){var c=Object.keys(a).reduce(function(b,c){var d=a[c];return d.hasOwnProperty("hasNull")&&!d.hasNull||"measure"!==d.type&&"period"!==d.scale||b.push(c),b},[]);return function(a){var d=!c.some(function(b){return!(b in a)||null===a[b]});return d||b(a),d}},autoAssignScales:function(a){var b="category",c={category:"ordinal",order:"ordinal",measure:"linear"},d={};return Object.keys(a).forEach(function(e){var f=a[e],g=(f.type||b).toLowerCase();d[e]={},d[e].type=g,d[e].scale=f.scale||c[g],d[e].value=f.value}),d},autoDetectDimTypes:function(b){var c={type:"category",scale:"ordinal"},e=function(b,c){var d=c;return a.isDate(b)?(d.type="measure",d.scale="time"):a.isObject(b)?(d.type="order",d.scale="ordinal"):a.isNumber(b)&&(d.type="measure",d.scale="linear"),d},f=function(a,b){return Object.keys(b).forEach(function(f){var g=b.hasOwnProperty(f)?b[f]:null;if(a[f]=a[f]||{type:null,hasNull:!1},null===g)a[f].hasNull=!0;else{var h=e(g,d.clone(c)),i=h.type,j=h.scale,k=null!==a[f].type&&a[f].type!==i;a[f].type=k?c.type:i,a[f].scale=k?c.scale:j}}),a};return a.reduce(b,f,{})}};b.DataProcessor=e}),e("utils/layuot-template",["exports","../const"],function(a,b){var c=b.CSS_PREFIX,d=function(a,b){var d="div",e=document.createElement(d);return e.classList.add(c+a),b&&b.appendChild(e),e},e=function(){var a=d("layout"),b=d("layout__header",a),c=d("layout__container",a),e=d("layout__sidebar",c),f=d("layout__content",c),g=d("layout__content__wrap",f),h=d("layout__sidebar-right",c),i=d("layout__sidebar-right__wrap",h),j=d("layout__footer",a);return{layout:a,header:b,content:g,leftSidebar:e,rightSidebar:i,footer:j}};a.getLayout=e}),e("charts/tau.plot",["exports","../dsl-reader","../api/balloon","../event","../spec-engine-factory","../layout-engine-factory","../plugins","../utils/utils","../utils/utils-dom","../const","../unit-domain-mixin","../units-registry","../data-processor","../utils/layuot-template"],function(c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=function(a,b){a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),a.__proto__=b},r=d.DSLReader,s=e.Tooltip,t=f.Emitter,u=g.SpecEngineFactory,v=h.LayoutEngineFactory,w=i.Plugins,x=i.propagateDatumEvents,y=j.utils,z=k.utilsDom,A=l.CSS_PREFIX,B=m.UnitDomainMixin,C=n.UnitsRegistry,D=o.DataProcessor,E=p.getLayout,F=function(a){var b;if(a.unit){var c=F(a.unit[0]),d=a.guide,e=d.x.$minimalDomain||1,f=d.y.$minimalDomain||1,g=Math.max(e*d.x.density,e*c.w),h=Math.max(f*d.y.density,f*c.h);b={w:g+d.padding.l+d.padding.r,h:h+d.padding.t+d.padding.b}}else b={w:0,h:0};return b},G=function(a,b,c,d){var e=b.guide.x.$minimalDomain||1,f=b.guide.y.$minimalDomain||1,g=c.width/e,h=c.height/f,i=a.dimension(b.x),j=a.dimension(b.y),k=d.hasOwnProperty("xDensityPadding:"+i.dimType)?d["xDensityPadding:"+i.dimType]:d.xDensityPadding,l=d.hasOwnProperty("yDensityPadding:"+j.dimType)?d["yDensityPadding:"+j.dimType]:d.yDensityPadding;if(b.guide.x.hide!==!0&&0!==b.guide.x.rotate&&g>b.guide.x.$maxTickTextW+2*k){b.guide.x.rotate=0,b.guide.x.textAnchor="middle",b.guide.x.tickFormatWordWrapLimit=g;var m=Math.min(d.xAxisTickLabelLimit,b.guide.x.$maxTickTextW),n=0-m+b.guide.x.$maxTickTextH;b.guide.padding.b+=b.guide.padding.b>0?n:0,b.guide.x.label.padding>m+d.xAxisPadding&&(b.guide.x.label.padding+=n)}b.guide.y.hide!==!0&&0!==b.guide.y.rotate&&1===b.guide.y.tickFormatWordWrapLines&&h>b.guide.y.$maxTickTextW+2*l&&(b.guide.y.tickFormatWordWrapLimit=h-2*l);var o={width:g,height:h};b.unit&&G(a,b.unit[0],o,d)},H=function(c){var d=function(a){c.call(this),this._svg=null,this._filtersStore={filters:{},tick:0},this._layout=E(),this.setupConfig(a),this._plugins=new w(this.config.plugins,this)};return q(d,c),d.prototype.setupConfig=function(b){this.config=a.defaults(b,{spec:{},data:[],plugins:[],settings:{}}),this._emptyContainer=b.emptyContainer||"",this.config.settings.specEngine=this.config.specEngine||this.config.settings.specEngine,this.config.settings.layoutEngine=this.config.layoutEngine||this.config.settings.layoutEngine,this.config.settings=this.setupSettings(this.config.settings),y.isArray(this.config.settings.specEngine)||(this.config.settings.specEngine=[{width:Number.MAX_VALUE,name:this.config.settings.specEngine}]),this.config.spec.dimensions=this.setupMetaInfo(this.config.spec.dimensions,this.config.data);var c=this.config.settings.log;this.config.settings.excludeNull&&this.addFilter({tag:"default",predicate:D.excludeNullValues(this.config.spec.dimensions,function(a){c([a,"point was excluded, because it has undefined values."],"WARN")})})},d.prototype.getConfig=function(){return this.config},d.prototype.setupMetaInfo=function(a,b){var c=a?a:D.autoDetectDimTypes(b);return D.autoAssignScales(c)},d.prototype.setupSettings=function(b){var c=d.globalSettings,e={};return Object.keys(c).forEach(function(b){e[b]=a.isFunction(c[b])?c[b]:y.clone(c[b])}),a.defaults(b||{},e)},d.prototype.insertToRightSidebar=function(a){return z.appendTo(a,this._layout.rightSidebar)},d.prototype.addBalloon=function(a){return new s("",a||{})},d.prototype.renderTo=function(c,d){this._renderGraph=null,this._svg=null,this._defaultSize=a.clone(d);var e=b.select(c),f=e.node();if(this._target=c,this._targetSizes=d,null===f)throw new Error("Target element not found");this._layout.content;f.appendChild(this._layout.layout),e=b.select(this._layout.content);var g=d||{};this._layout.content.innerHTML="",g.width&&g.height||(g=a.defaults(g,z.getContainerSize(this._layout.content.parentNode)));var h=this.getData();if(0===h.length)return void(this._layout.content.innerHTML=this._emptyContainer);this._targetSizes=g,this._layout.content.innerHTML="";var i=new B(this.config.spec.dimensions,h),j=a.find(this.config.settings.specEngine,function(a){return g.width<=a.width}),k=u.get(j.name,this.config.settings),l=k(this.config.spec,i.mix({})),m=F(l.unit),n=m.w,o=m.h,p=z.getScrollbarWidth(),q=g.width-n,s=g.height-o,t=q>=0?g.width:n,w=s>=0?0:p,y=s>=0?g.height:o,D=q>=0?0:p;g.height=y-D,g.width=t-w;var E=this.config.settings;G(i.mix({}),l.unit,g,E);var H=new r(i,C),I=this,J=H.buildGraph(l),K=v.get(this.config.settings.layoutEngine)(J),L=H.calcLayout(K,g),M=H.renderGraph(L,e.append("svg").attr("class",A+"svg").attr("width",g.width).attr("height",g.height),function(a){return I.fire("unitready",a)});this._renderGraph=L,this._svg=M.node(),M.selectAll(".i-role-datum").call(x(this)),this._layout.rightSidebar.style.maxHeight=g.height+"px",this.fire("render",this._svg)},d.prototype.getData=function(b){b=b||{};var c=a.chain(this._filtersStore.filters).values().flatten().reject(function(c){return a.contains(b.excludeFilter,c.tag)}).pluck("predicate").value();return a.filter(this.config.data,a.reduce(c,function(a,b){return function(c){return a(c)&&b(c)}},function(){return!0}))},d.prototype.setData=function(a){this.config.data=a,this.refresh()},d.prototype.getSVG=function(){return this._svg},d.prototype.addFilter=function(a){var b=a.tag,c=this._filtersStore.filters[b]=this._filtersStore.filters[b]||[],d=this._filtersStore.tick++;return a.id=d,c.push(a),this.refresh(),d},d.prototype.removeFilter=function(b){var c=this;a.each(this._filtersStore.filters,function(d,e){c._filtersStore.filters[e]=a.reject(d,function(a){return a.id===b})}),this.refresh()},d.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},d.prototype.resize=function(a){void 0===a&&(a={}),this.renderTo(this._target,a)},d.prototype.select=function(a){var b=[];if(!this._renderGraph)return b;var c=function(a,b){b(a),(a.childUnits||[]).forEach(function(a){return c(a,b)})};return c(this._renderGraph,function(c){a(c)&&b.push(c)}),b},d}(t);c.Plot=H}),e("charts/tau.chart",["exports","./tau.plot","../utils/utils","../data-processor"],function(b,c,d,e){function f(a,b,c){return b.reduce(function(b,d,e){var f=a[d];return f?b.status!=o.FAIL&&("measure"===f.type&&(b.countMeasureAxis++,b.indexMeasureAxis.push(e)),"measure"!==f.type&&1===b.countMeasureAxis?b.status=o.WARNING:b.countMeasureAxis>1&&(b.status=o.FAIL,b.messages.push('There are more then one measure dimensions for axis "'+c+'"'))):(b.status=o.FAIL,b.messages.push('Undefined dimension "'+d+'" for axis "'+c+'"')),b},{status:o.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[]})}function g(b,c){var d=m(c.x),e=m(c.y),g=f(c.dimensions,d,"x"),h=f(c.dimensions,e,"y");d=p[g.status](d,g),e=p[h.status](e,h);for(var i=m(c.guide),j=Math.max(d.length,e.length);i.length0;o--){var q=d.pop(),r=e.pop(),s=i.pop()||{};o===j?(k.x=q,k.y=r,k.unit.push(n(b,{x:l(q),y:l(r),color:c.color,size:c.size,flip:c.flip,colorGuide:s.color})),k.guide=a.defaults(s,{x:{label:q},y:{label:r}})):k={type:"COORDS.RECT",x:l(q),y:l(r),unit:[k],guide:a.defaults(s,{x:{label:q},y:{label:r}})}}return c.spec={dimensions:c.dimensions,unit:k},c}var h=function(a,b){a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),a.__proto__=b},i=c.Plot,j=d.utils,k=e.DataProcessor,l=function(a){return a?a:null},m=function(a){return j.isArray(a)?a:[a]},n=function(a,b){return{type:a,x:b.x,y:b.y,color:b.color,guide:{color:b.colorGuide},flip:b.flip,size:b.size}},o={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},p=function(b){return b[o.SUCCESS]=function(a){return a},b[o.FAIL]=function(a,b){throw new Error((b.messages||[]).join("\n")||"This configuration is not supported, See http://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart")},b[o.WARNING]=function(b,c){var d=b[c.indexMeasureAxis[0]],e=a.without(b,d);return e.push(d),e},b}({}),q={scatterplot:function(a){return g("ELEMENT.POINT",a)},line:function(b){var c=b.data,d=b.settings.log,e={none:function(){return null},horizontal:function(a){var b=j.isArray(a.x)?a.x:[a.x];return b[b.length-1]},vertical:function(a){var b=j.isArray(a.y)?a.y:[a.y];return b[b.length-1]},auto:function(a){var b,e=j.isArray(a.x)?a.x:[a.x],f=j.isArray(a.y)?a.y:[a.y],g=e[e.length-1],h=e.slice(0,e.length-1),i=f[f.length-1],l=f.slice(0,f.length-1),m=a.color,n=h.concat(l).concat([m]).filter(function(a){return null!==a}),o=-1,p=[[[g].concat(n),i],[[i].concat(n),g]],q=p.some(function(a,b){var e=a[0],f=a[1],g=k.isYFunctionOfX(c,e,[f]);return g.result?o=b:d(["Attempt to find a functional relation between",a[0]+" and "+a[1]+" is failed.","There are several "+g.error.keyY+" values (e.g. "+g.error.errY.join(",")+")","for ("+g.error.keyX+" = "+g.error.valX+")."].join(" ")),g.result});return q?b=p[o][0][0]:(d(["All attempts are failed.","Will orient line horizontally by default.","NOTE: the [scatterplot] chart is more convenient for that data."].join(" ")),b=g),b}},f=(b.lineOrientation||"auto").toLowerCase(),h=e.hasOwnProperty(f)?e[f]:e.auto,i=h(b);return null!==i&&(b.data=a(c).sortBy(i)),g("ELEMENT.LINE",b)},bar:function(a){return a.flip=!1,g("ELEMENT.INTERVAL",a)},horizontalBar:function(a){return a.flip=!0,g("ELEMENT.INTERVAL",a)}},r=function(b){var c=function d(c){c=a.defaults(c,{autoResize:!0}),c.autoResize&&d.winAware.push(this),c.settings=this.setupSettings(c.settings),c.dimensions=this.setupMetaInfo(c.dimensions,c.data);var e=q[c.type];if(!a.isFunction(e))throw new Error("Chart type "+c.type+" is not supported. Use one of "+a.keys(q).join(", ")+".");b.call(this,e(c))};return h(c,b),c.prototype.destroy=function(){var a=c.winAware.indexOf(this);-1!==a&&c.winAware.splice(a,1),b.prototype.destroy.call(this)},c}(i);r.resizeOnWindowEvent=function(){function a(){!c&&r.winAware.length&&(c=d(b))}function b(){c=0;for(var a,b=0,d=r.winAware.length;d>b;b++)a=r.winAware[b],a.resize()}var c,d=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(a){return setTimeout(a,17)};return a}(),r.winAware=[],window.addEventListener("resize",r.resizeOnWindowEvent),b.Chart=r}),e("elements/coords",["exports","../utils/utils-draw","../const","../utils/utils","../matrix"],function(b,c,d,e,f){var g=c.utilsDraw,h=d.CSS_PREFIX,i=e.utils,j=f.TMatrix,k={CROSS:function(b,c,d,e,f){var g=0===d.length?[null]:d,h=0===f.length?[null]:f.reverse();return a(h).map(function(b){return a(g).map(function(a){var d={};return c&&(d[c]=a),e&&(d[e]=b),d})})}},l=function(a){return k[a]||function(){return[[{}]]}},m=function(b,c,d){var e=a.defaults(i.clone(b),a.pick.apply(a,[c].concat(d)));return e.guide=a.extend(i.clone(c.guide),e.guide),e},n={walk:function(b,c){var d=a.defaults(b,{$where:{}}),e=a.any(d.unit,function(a){return 0===a.type.indexOf("COORDS.")}),f=l(e?"CROSS":""),g=new j(f(d,d.x,d.domain(d.x),d.y,d.domain(d.y))),h=new j(g.sizeR(),g.sizeC());return g.iterate(function(b,c,e){var f=a.extend({},d.$where,e),g=a(d.unit).map(function(b){return a.extend(m(b,d,["x","y"]),{$where:f})});h.setRC(b,c,g)}),d.$matrix=h,h.iterate(function(b,d,e){a.each(e,function(a){return c(a)})}),d},draw:function(a){var b=a.options,c=a.guide.padding;a.x.guide=a.guide.x,a.y.guide=a.guide.y;var d=b.left+c.l,e=b.top+c.t,f=b.width-(c.l+c.r),i=b.height-(c.t+c.b);a.x.scaleObj=a.x.scaleDim&&a.scaleTo(a.x.scaleDim,[0,f],a.x.guide),a.y.scaleObj=a.y.scaleDim&&a.scaleTo(a.y.scaleDim,[i,0],a.y.guide),a.x.guide.size=f,a.y.guide.size=i;var j=[0,i+a.guide.x.padding],k=[0-a.guide.y.padding,0],l=b.container.append("g").attr("class",h+"cell cell").attr("transform",g.translate(d,e)).datum({$where:a.$where});return a.x.guide.hide||g.fnDrawDimAxis.call(l,a.x,j,f),a.y.guide.hide||g.fnDrawDimAxis.call(l,a.y,k,i),g.fnDrawGrid.call(l,a,i,f)}};b.coords=n}),e("utils/css-class-map",["exports","../const"],function(a,b){function c(a){return g[a-1]||g[4]}function d(a){var b=0;return a>=160&&320>a?b=1:a>=320&&480>a?b=2:a>=480&&640>a?b=3:a>=640&&(b=4),h[b]}var e=b.CSS_PREFIX,f=[1,2,3,4,5],g=f.map(function(a){return e+"line-opacity-"+a}),h=f.map(function(a){return e+"line-width-"+a});a.getLineClassesByWidth=d,a.getLineClassesByCount=c}),e("elements/line",["exports","../const","../utils/css-class-map"],function(a,c,d){var e=c.CSS_PREFIX,f=d.getLineClassesByWidth,g=d.getLineClassesByCount,h=function(a){var c=a.options,d=c.xScale,h=c.yScale,i=c.color,j=a.groupBy(a.partition(),i.dimension),k=f(c.width),l=g(j.length),m=function(){this.attr("class",function(a){return""+e+"line i-role-element i-role-datum line "+i.get(a.key)+" "+k+" "+l});var a=this.selectAll("path").data(function(a){return[a.values]});a.call(p),a.enter().append("path").call(p),a.exit().remove()},n=function(b){var f=function(){return this.attr("r",1.5).attr("class",function(a){return""+e+"dot-line dot-line i-role-element "+e+"dot i-role-datum "+i.get(a[i.dimension])}).attr("cx",function(b){return d(b[a.x.scaleDim])}).attr("cy",function(b){return h(b[a.y.scaleDim])})},g=c.container.selectAll(".dot-line").data(b);g.call(f),g.exit().remove(),g.enter().append("circle").call(f)},o=b.svg.line().x(function(b){return d(b[a.x.scaleDim])}).y(function(b){return h(b[a.y.scaleDim])}),p=function(){this.attr("d",o)},q=j.reduce(function(a,b){var c=b.values;return 1===c.length&&a.push(c[0]),a},[]);q.length>0&&n(q);var r=c.container.selectAll(".line").data(j);r.call(m),r.enter().append("g").call(m),r.exit().remove()};a.line=h}),e("elements/point",["exports","../const"],function(a,b){var c=b.CSS_PREFIX,d=function(a){var b=a.options,d=b.xScale,e=b.yScale,f=b.color,g=b.sizeScale,h=function(){return this.attr("r",function(b){return g(b[a.size.scaleDim])}).attr("cx",function(b){return d(b[a.x.scaleDim])}).attr("cy",function(b){return e(b[a.y.scaleDim])}).attr("class",function(a){return""+c+"dot dot i-role-element i-role-datum "+f.get(a[f.dimension])})},i=b.container.selectAll(".dot").data(a.partition());i.call(h),i.exit().remove(),i.enter().append("circle").call(h)};a.point=d}),e("elements/interval",["exports","../utils/utils-draw","../const"],function(a,b,c){var d=function(a){return Array.isArray(a)?a:Array.from(a)},e=b.utilsDraw,f=c.CSS_PREFIX,g="i-role-bar-group",h=function(a){return"measure"===a.dimType},i=function(a){var b=a.size/a.domain().length,c=b/(a.categories.length+1);return{tickWidth:b,intervalWidth:c,offsetCategory:c}},j={NORM:function(a,b,c,f,g,j,k){var l=1,m=Math.min.apply(Math,d(c.domain())),n=!isNaN(m),o=!n||0>=m?0:m,p=h(a.x),q=p?k:i({domain:b.domain,categories:j,size:f}),r=q.tickWidth,s=q.intervalWidth,t=q.offsetCategory,u=function(c){return b(c[a.x.scaleDim])-r/2},v=n?function(b){var d=b[a.y.scaleDim],e=c(Math.max(o,d)),f=Math.abs(c(d)-c(o)),g=l>f;return g&&d>0?e-l:e}:function(b){return c(b[a.y.scaleDim])},w=function(){return s},x=n?function(b){var d=b[a.y.scaleDim],e=Math.abs(c(d)-c(o));return 0===d?e:Math.max(l,e)}:function(b){return g-c(b[a.y.scaleDim])},y=function(a,b){return e.translate(b*t+t/2,0)};return{calculateX:u,calculateY:v,calculateWidth:w,calculateHeight:x,calculateTranslate:y}},FLIP:function(a,b,c,f,g,j,k){var l=1,m=Math.min.apply(Math,d(b.domain())),n=!isNaN(m),o=!n||0>=m?0:m,p=h(a.y),q=p?k:i({domain:c.domain,categories:j,size:g}),r=q.tickWidth,s=q.intervalWidth,t=q.offsetCategory,u=n?function(c){var d=c[a.x.scaleDim],e=Math.abs(b(d)-b(o)),f=b(Math.min(o,d)),g=e-l,h=d>0?l+g:0>d?0-l:0,i=0>g;return i?f+h:f}:0,v=function(b){return c(b[a.y.scaleDim])-r/2},w=n?function(c){var d=c[a.x.scaleDim],e=Math.abs(b(d)-b(o));return 0===d?e:Math.max(l,e)}:function(c){return b(c[a.x.scaleDim])},x=function(){return s},y=function(a,b){return e.translate(0,b*t+t/2)};return{calculateX:u,calculateY:v,calculateWidth:w,calculateHeight:x,calculateTranslate:y}}},k=function(a){var b=a.options,c=b.xScale,d=b.yScale,e=b.color,h=a.groupBy(a.partition(),e.dimension),i=j[a.flip?"FLIP":"NORM"],k=i(a,c,d,b.width,b.height,h,{tickWidth:5,intervalWidth:5,offsetCategory:0}),l=k.calculateX,m=k.calculateY,n=k.calculateWidth,o=k.calculateHeight,p=k.calculateTranslate,q=function(){return this.attr("height",o).attr("width",n).attr("class",function(a){return"i-role-element i-role-datum bar "+f+"bar "+e.get(a[e.dimension])}).attr("x",l).attr("y",m)},r=function(){this.attr("class",g).attr("transform",p);var a=this.selectAll("bar").data(function(a){return a.values});a.call(q),a.enter().append("rect").call(q),a.exit().remove()},s=b.container.selectAll("."+g).data(h);s.call(r),s.enter().append("g").call(r),s.exit().remove()};a.interval=k}),e("elements/coords-parallel",["exports","../utils/utils-draw","../const","../utils/utils","../matrix"],function(c,d,e,f,g){var h=d.utilsDraw,i=(e.CSS_PREFIX,f.utils),j=g.TMatrix,k=function(b,c,d){var e=a.defaults(i.clone(b),a.pick.apply(a,[c].concat(d)));return e.guide=a.extend(i.clone(c.guide||{}),e.guide||{}),e},l={walk:function(b,c){var d=a.defaults(b,{$where:{}}),e=new j(1,1),f=new j(1,1);return e.iterate(function(b,c){var e=a.extend({},d.$where),g=a(d.unit).map(function(b){return a.extend(k(b,d,["x"]),{$where:e})});f.setRC(b,c,g)}),d.$matrix=f,f.iterate(function(b,d,e){a.each(e,function(a){return c(a)})}),d},draw:function(a){var c=a.options,d=a.guide.padding,e=c.left+d.l,f=c.top+d.t,g=c.width-(d.l+d.r),i=c.height-(d.t+d.b),j=a.x.map(function(b){return a.scaleTo(b,[i,0],{})}),k=c.container.append("g").attr("class","graphical-report__cell cell").attr("transform",h.translate(e,f)),l=function(a,b){return"translate("+a+","+b+")"},m=function(a){return"rotate("+a+")"},n=function(a,c){var d=this,e=b.svg.axis().scale(a).orient("left"),f=d.append("g").attr("class","y axis").attr("transform",l.apply(null,c)).call(e);f.selectAll(".tick text").attr("transform",m(0)).style("text-anchor","end")},o=g/(a.x.length-1);return j.forEach(function(a,b){n.call(k,a,[b*o,0])}),k.append("g").attr("class","grid").attr("transform",l(0,0))}};c.CoordsParallel=l}),e("elements/coords-parallel-line",["exports","../utils/utils-draw","../const"],function(a,c,d){var e=c.utilsDraw,f=(d.CSS_PREFIX,{draw:function(a){a.color=a.dimension(a.color,a);var c=a.options,d=a.x.reduce(function(b,d){return b[d]=a.scaleTo(d,[c.height,0],{}),b},{}),f=e.generateColor(a),g=b.nest().key(function(a){return a[f.dimension]}).entries(a.partition()).map(function(b){var c=b.values[0],d=[];return a.x.forEach(function(a){d.push({key:a,val:c[a]})}),d}),h=function(){this.attr("class",function(){return"graphical-report__line line color10-9"});var a=this.selectAll("path").data(function(a){return[a]});a.call(l),a.enter().append("path").call(l),a.exit().remove()},i=c.width/(a.x.length-1),j={};a.x.forEach(function(a,b){j[a]=b*i});var k=b.svg.line().x(function(a){return j[a.key]}).y(function(a){return d[a.key](a.val)}),l=function(){this.attr("d",k)},m=c.container.selectAll(".line").data(g);m.call(h),m.enter().append("g").call(h),m.exit().remove()}});a.CoordsParallelLine=f}),e("elements/size",["exports"],function(b){var c=function(a){return Math.sqrt(a)},d=function(b,d,e,f){var g=a.filter(b,a.isFinite);if(0===g.length)return function(){return f};var h=1,i=0,j=Math.min.apply(null,g),k=Math.max.apply(null,g),l=c(Math.max.apply(null,[Math.abs(j),Math.abs(k),k-j]));return i=0>j?j:0,h=0===l?1:(e-d)/l,function(b){var f=null!==b?parseFloat(b):0;if(!a.isFinite(f))return e;var g=f-i;return d+c(g)*h}};b.sizeScale=d}),e("node-map",["exports","./elements/coords","./elements/line","./elements/point","./elements/interval","./utils/utils-draw","./elements/coords-parallel","./elements/coords-parallel-line","./elements/size"],function(b,c,d,e,f,g,h,i,j){var k=c.coords,l=d.line,m=e.point,n=f.interval,o=g.utilsDraw,p=h.CoordsParallel,q=i.CoordsParallelLine,r=j.sizeScale,s=function(b,c){c.forEach(function(a){b[a]=b.dimension(b[a],b)});var d=b.options,e=d.width,f=d.height;if(b.x.guide=b.guide.x,b.y.guide=b.guide.y,b.options.xScale=b.x.scaleDim&&b.scaleTo(b.x.scaleDim,[0,e],b.x.guide),b.options.yScale=b.y.scaleDim&&b.scaleTo(b.y.scaleDim,[f,0],b.y.guide),b.options.color=o.generateColor(b),b.size){var g=.5*a.min([b.guide.x.tickFontHeight,b.guide.y.tickFontHeight].filter(function(a){return 0!==a})),h=.5*a.min([b.guide.x.density,b.guide.y.density].filter(function(a){return 0!==a}));b.options.sizeScale=r(b.domain(b.size.scaleDim),2,h,g)}return b},t={"COORDS.RECT":{walk:k.walk,draw:function(a,b){return a.x=a.dimension(a.x,a),a.y=a.dimension(a.y,a),k.draw(a,b)}},"ELEMENT.POINT":function(a){return m(s(a,["x","y","color","size"]))},"ELEMENT.LINE":function(a){return l(s(a,["x","y","color"]))},"ELEMENT.INTERVAL":function(a){return n(s(a,["x","y","color"]))},"COORDS.PARALLEL":p,"PARALLEL/ELEMENT.LINE":q};b.nodeMap=t}),e("tau.newCharts",["exports","./utils/utils-dom","./charts/tau.plot","./charts/tau.chart","./unit-domain-mixin","./unit-domain-period-generator","./dsl-reader","./spec-engine-factory","./layout-engine-factory","./formatter-registry","./node-map","./units-registry"],function(c,d,e,f,g,h,i,j,k,l,m,n){var o=d.utilsDom,p=e.Plot,q=f.Chart,r=g.UnitDomainMixin,s=h.UnitDomainPeriodGenerator,t=i.DSLReader,u=j.SpecEngineFactory,v=k.LayoutEngineFactory,w=l.FormatterRegistry,x=m.nodeMap,y=n.UnitsRegistry,z={},A={},B={UnitDomainMixin:r,UnitDomainPeriodGenerator:s,DSLReader:t,SpecEngineFactory:u,LayoutEngineFactory:v},C={UnitsRegistry:y,tickFormat:w,d3:b,_:a,tickPeriod:s,colorBrewers:{add:function(a,b){a in z||(z[a]=b)},get:function(a){return z[a]}},plugins:{add:function(a,b){if(a in A)throw new Error("Plugins is already registred.");A[a]=b},get:function(a){return A[a]}},globalSettings:{log:function(a,b){b=b||"INFO",Array.isArray(a)||(a=[a]),console[b.toLowerCase()].apply(console,a)},excludeNull:!0,specEngine:[{name:"COMPACT",width:600},{name:"AUTO",width:Number.MAX_VALUE}],layoutEngine:"EXTRACT",getAxisTickLabelSize:o.getAxisTickLabelSize,xAxisTickLabelLimit:100,yAxisTickLabelLimit:100,xTickWordWrapLinesLimit:2,yTickWordWrapLinesLimit:2,xTickWidth:9,yTickWidth:9,distToXAxisLabel:20,distToYAxisLabel:20,xAxisPadding:20,yAxisPadding:20,xFontLabelHeight:10,yFontLabelHeight:10,xDensityPadding:4,yDensityPadding:4,"xDensityPadding:measure":8,"yDensityPadding:measure":8,defaultFormats:{measure:"x-num-auto","measure:time":"x-time-auto","measure:time:year":"year","measure:time:quarter":"quarter","measure:time:month":"month","measure:time:week":"x-time-auto","measure:time:day":"x-time-auto","measure:time:hour":"x-time-auto","measure:time:min":"x-time-auto","measure:time:sec":"x-time-auto","measure:time:ms":"x-time-auto"}}};p.globalSettings=C.globalSettings,C.UnitsRegistry.add("COORDS.PARALLEL",x["COORDS.PARALLEL"]).add("PARALLEL/ELEMENT.LINE",x["PARALLEL/ELEMENT.LINE"]).add("COORDS.RECT",x["COORDS.RECT"]).add("ELEMENT.POINT",x["ELEMENT.POINT"]).add("ELEMENT.LINE",x["ELEMENT.LINE"]).add("ELEMENT.INTERVAL",x["ELEMENT.INTERVAL"]),c.Plot=p,c.Chart=q,c.__api__=B,c.api=C +}),e("underscore",function(){return a}),e("d3",function(){return b}),d("tau.newCharts")}),function(a){if("function"==typeof define&&define.amd)define(["tauCharts"],function(b){return a(b)});else if("object"==typeof module&&module.exports){{require("tauCharts")}module.exports=a()}else a(this.tauCharts)}(function(a){var b=function(a){if(a.color)return a;var c,d,e,f=a.unit||[];for(c=0;c',_template:c.template('
<%=name%>
<%=items%>'),_itemTemplate:c.template(["
\">",'
<%=label%>',"
"].join("")),onRender:function(a){if(this._container){var d=this._unit.options.color,e=d.dimension,f=this._getColorMap(a,d,e),g=a.getConfig(),h=b(g.spec.unit);h.guide=h.guide||{},h.guide.color=this._unit.guide.color,h.guide.color.brewer=f;var i=c.map(f,function(a,b){var d=JSON.stringify({dimension:e,value:b,color:a});return this._itemTemplate({color:a,classDisabled:this._currentFilters[d]?"disabled":"",label:c.escape(b),value:d})},this).join("");this._container.innerHTML=this._template({items:i,name:this._unit.guide.color.label.text||this._unit.options.color.dimension})}}}};return a.api.plugins.add("legend",e),e}),function(a){if("function"==typeof define&&define.amd)define(["tauCharts"],function(b){return a(b)});else if("object"==typeof module&&module.exports){{require("tauCharts")}module.exports=a()}else a(this.tauCharts)}(function(a){function b(a){return a=a||{},{template:['
','
','
','Exclude',"
","
"].join(""),itemTemplate:['
','
<%=label%>
','
<%=value%>
',"
"].join(""),onExcludeData:function(){},_drawPoint:function(a,b,c,d){this.circle&&this.circle.remove(),this.circle=a.append("circle").attr("cx",b).attr("cy",c).attr("class",d).attr("r",4),this.circle.node().addEventListener("mouseover",function(){clearTimeout(this._timeoutHideId)}.bind(this),!1),this.circle.node().addEventListener("mouseleave",function(){this._hide()}.bind(this),!1)},formatters:{},_getFormatter:function(a){return this.formatters[a]||c.identity},init:function(b){this._chart=b,this._dataFields=a.fields,this._getDataFields=a.getFields,c.extend(this,c.omit(a,"fields","getFields")),this._timeoutHideId=null,this._dataWithCoords={},this._unitMeta={},this._templateItem=c.template(this.itemTemplate),this._tooltip=b.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._elementTooltip=this._tooltip.getElement();var d=this._elementTooltip;d.addEventListener("mouseover",function(){clearTimeout(this._timeoutHideId)}.bind(this),!1),d.addEventListener("mouseleave",function(){this._hide()}.bind(this),!1),d.addEventListener("click",function(a){for(var b=a.target;b!==a.currentTarget&&null!==b;)b.classList.contains("i-role-exclude")&&(this._exclude(),this._hide()),b=b.parentNode}.bind(this),!1),d.insertAdjacentHTML("afterbegin",this.template)},onUnitReady:function(a,b){if(b.type&&0===b.type.indexOf("ELEMENT")){var c=this._generateKey(b.$where);this._unitMeta[c]=b;var d=b.partition();this._dataWithCoords[c]=d.map(function(a){return{x:b.options.xScale(a[b.x.scaleDim]),y:b.options.yScale(a[b.y.scaleDim]),item:a}},this)}},render:function(a,b){return b=c.unique(b),b.map(function(b){var d=a[b],e=c.isNull(d)||c.isUndefined(d)?"No "+b:d;return this._templateItem({label:b,value:this._getFormatter(b)(e)})},this).join("")},onRender:function(a){c.isFunction(this._getDataFields)&&(this._dataFields=this._getDataFields(a)),this._hide()},_exclude:function(){this._chart.addFilter({tag:"exclude",predicate:function(a){return function(b){return JSON.stringify(b)!==JSON.stringify(a)}}(this._currentElement)}),this.onExcludeData(this._currentElement)},_calculateLength:function(a,b,c,d){return(c-a)*(c-a)+(d-b)*(d-b)},_calculateLengthToLine:function(a,b,c,d,f,g){var h={x:c-a,y:d-b},i={x:f-a,y:g-b},j=h.x*i.x+h.y*i.y;if(0>j)return e(a,f,b,g);var k={x:a-c,y:b-d},l={x:f-c,y:g-d},m=k.x*l.x+k.y*l.y;return 0>m?e(c,f,d,g):Math.abs(((c-a)*(g-b)-(d-b)*(f-a))/e(a,c,b,d))},_generateKey:function(a){return JSON.stringify(a)},_getFields:function(a){if(this._dataFields)return this._dataFields;for(var b=[a.size&&a.size.scaleDim,a.color&&a.color.scaleDim],d=[],e=[];a=a.parentUnit;)d.push(a.x.scaleDim),e.push(a.y.scaleDim);return c.compact(b.concat(e,d).reverse())},isLine:function(a){return a.elementData.key&&Array.isArray(a.elementData.values)},_onElementMouseOver:function(a,b,e,f){clearTimeout(this._timeoutHideId);var g=this._generateKey(b.cellData.$where),h=b.elementData,i=this.isLine(b);if(i){var j=this._dataWithCoords[g],k=j.filter(function(a){return c.contains(h.values,a.item)}),l=c.reduce(k,function(a,b,c,d){var f;if(c+1===d.length){var g=b;b=d[c-1],f=g}else f=d[c+1];var h=this._calculateLengthToLine(b.x,b.y,f.x,f.y,e[0],e[1]);return h1&&f("i-trendline-"+e,n,j.xScale,j.yScale,j.color.get(g),j.container)});var r=function(a){return function(){var b=e.select(this);b.classed({active:a,"graphical-report__line-width-1":!a,"graphical-report__line-width-2":a})}};j.container.selectAll(".graphical-report__trendline").on("mouseenter",r(!0)).on("mouseleave",r(!1))}},containerTemplate:'
',template:d.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(){if(this._container){var a=this.isApplicable?"applicable-true":"applicable-false",c=this.isApplicable?"applicable-false":"applicable-true";this._container.classList.add(a),this._container.classList.remove(c),this._container.innerHTML=this.template({title:"Trend line",error:this.error,showTrend:b.showTrend&&this.isApplicable?"checked":"",models:["linear","exponential","logarithmic"].map(function(a){var c=b.type===a?"selected":"";return""})})}}}}var c=function(){"use strict";var a=function(a,b){var c=0,d=0,e=0,f=0,g=0,h=a.length-1,i=new Array(b);for(c=0;h>c;c++){for(f=c,d=c+1;h>d;d++)Math.abs(a[c][d])>Math.abs(a[c][f])&&(f=d);for(e=c;h+1>e;e++)g=a[e][c],a[e][c]=a[e][f],a[e][f]=g;for(d=c+1;h>d;d++)for(e=h;e>=c;e--)a[e][d]-=a[e][c]*a[c][d]/a[c][c]}for(d=h-1;d>=0;d--){for(g=0,e=d+1;h>e;e++)g+=a[e][d]*i[e];i[d]=(a[h][d]-g)/a[d][d]}return i},b={linear:function(a){for(var b=[0,0,0,0,0],c=0,d=[];cg;g++){var i=[a[g][0],a[g][0]*e+f];d.push(i)}var j="y = "+Math.round(100*e)/100+"x + "+Math.round(100*f)/100;return{equation:[e,f],points:d,string:j}},exponential:function(a){var b=[0,0,0,0,0,0],c=0,d=[];for(i=a.length;i>c;c++)a[c][1]&&(b[0]+=a[c][0],b[1]+=a[c][1],b[2]+=a[c][0]*a[c][0]*a[c][1],b[3]+=a[c][1]*Math.log(a[c][1]),b[4]+=a[c][0]*a[c][1]*Math.log(a[c][1]),b[5]+=a[c][0]*a[c][1]);for(var e=b[1]*b[2]-b[5]*b[5],f=Math.pow(Math.E,(b[2]*b[3]-b[5]*b[4])/e),g=(b[1]*b[4]-b[5]*b[3])/e,h=0,i=a.length;i>h;h++){var j=[a[h][0],f*Math.pow(Math.E,g*a[h][0])];d.push(j)}var k="y = "+Math.round(100*f)/100+"e^("+Math.round(100*g)/100+"x)";return{equation:[f,g],points:d,string:k}},logarithmic:function(a){var b=[0,0,0,0],c=0,d=[];for(h=a.length;h>c;c++)a[c][1]&&(b[0]+=Math.log(a[c][0]),b[1]+=a[c][1]*Math.log(a[c][0]),b[2]+=a[c][1],b[3]+=Math.pow(Math.log(a[c][0]),2));for(var e=(c*b[1]-b[2]*b[0])/(c*b[3]-b[0]*b[0]),f=(b[2]-e*b[0])/c,g=0,h=a.length;h>g;g++){var i=[a[g][0],f+e*Math.log(a[g][0])];d.push(i)}var j="y = "+Math.round(100*f)/100+" + "+Math.round(100*e)/100+" ln(x)";return{equation:[f,e],points:d,string:j}},power:function(a){var b=[0,0,0,0],c=0,d=[];for(h=a.length;h>c;c++)a[c][1]&&(b[0]+=Math.log(a[c][0]),b[1]+=Math.log(a[c][1])*Math.log(a[c][0]),b[2]+=Math.log(a[c][1]),b[3]+=Math.pow(Math.log(a[c][0]),2));for(var e=(c*b[1]-b[2]*b[0])/(c*b[3]-b[0]*b[0]),f=Math.pow(Math.E,(b[2]-e*b[0])/c),g=0,h=a.length;h>g;g++){var i=[a[g][0],f*Math.pow(a[g][0],e)];d.push(i)}var j="y = "+Math.round(100*f)/100+"x^"+Math.round(100*e)/100;return{equation:[f,e],points:d,string:j}},polynomial:function(b,c){"undefined"==typeof c&&(c=2);for(var d=[],e=[],f=[],g=0,h=0,i=0,j=c+1;j>i;i++){for(var k=0,l=b.length;l>k;k++)b[k][1]&&(g+=Math.pow(b[k][0],i)*b[k][1]);d.push(g),g=0;for(var m=[],n=0;j>n;n++){for(var k=0,l=b.length;l>k;k++)b[k][1]&&(h+=Math.pow(b[k][0],i+n));m.push(h),h=0}e.push(m)}e.push(d);for(var o=a(e,j),i=0,l=b.length;l>i;i++){for(var p=0,q=0;q=0;i--)r+=i>1?Math.round(100*o[i])/100+"x^"+i+" + ":1==i?Math.round(100*o[i])/100+"x + ":Math.round(100*o[i])/100;return{equation:o,points:f,string:r}},lastvalue:function(a){for(var b=[],c=null,d=0;d