diff --git a/bower.json b/bower.json index 7166a6e28..d1e29429d 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tauCharts", - "version": "0.2.16", + "version": "0.2.17", "homepage": "https://github.com/TargetProcess/tauCharts", "description": "Simple charts library based on d3", "keywords": [ diff --git a/build/plugins/tauCharts.legend.min.js b/build/plugins/tauCharts.legend.min.js index 465fe7003..625000f0a 100644 --- a/build/plugins/tauCharts.legend.min.js +++ b/build/plugins/tauCharts.legend.min.js @@ -1,4 +1,4 @@ -/*! tauCharts - v0.2.16 - 2014-12-17 +/*! tauCharts - v0.2.17 - 2014-12-17 * https://github.com/TargetProcess/tauCharts * Copyright (c) 2014 Taucraft Limited; Licensed Creative Commons */ !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}); \ No newline at end of file diff --git a/build/plugins/tauCharts.tooltip.js b/build/plugins/tauCharts.tooltip.js index 62ef40a60..1403c8457 100644 --- a/build/plugins/tauCharts.tooltip.js +++ b/build/plugins/tauCharts.tooltip.js @@ -19,8 +19,9 @@ var _ = tauCharts.api._; var d3 = tauCharts.api.d3; var dim = function (x0, x1, y0, y1) { - return Math.sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)); - }; + return Math.sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)); + }; + function tooltip(settings) { settings = settings || {}; return { @@ -41,7 +42,8 @@ if (this.circle) { this.circle.remove(); } - this.circle = container.append("circle") + this.circle = container + .append("circle") .attr("cx", x) .attr("cy", y) .attr('class', color) @@ -53,6 +55,10 @@ this._hide(); }.bind(this), false); }, + formatters:{}, + _getFormatter:function(field){ + return this.formatters[field] || _.identity; + }, init: function (chart) { this._chart = chart; this._dataFields = settings.fields; @@ -101,11 +107,11 @@ var value = (_.isNull(v) || _.isUndefined(v)) ? ('No ' + field) : v; return this._templateItem({ label: field, - value: value + value: this._getFormatter(field)(value) }); }, this).join(''); }, - onRender:function(){ + onRender: function () { this._hide(); }, _exclude: function () { @@ -214,7 +220,7 @@ var placeCoord = d3.mouse(document.body); var coord = d3.mouse(data.element); clearTimeout(this._timeoutShowId); - this._timeoutShowId = _.delay(this._onElementMouseOver.bind(this),200, chart, data, coord, placeCoord); + this._timeoutShowId = _.delay(this._onElementMouseOver.bind(this), 200, chart, data, coord, placeCoord); }, onElementMouseOut: function (mouseСoord, placeCoord) { this._hide(); diff --git a/build/plugins/tauCharts.tooltip.min.js b/build/plugins/tauCharts.tooltip.min.js index 78aed83cd..fb3e05421 100644 --- a/build/plugins/tauCharts.tooltip.min.js +++ b/build/plugins/tauCharts.tooltip.min.js @@ -1,4 +1,4 @@ -/*! tauCharts - v0.2.16 - 2014-12-17 +/*! tauCharts - v0.2.17 - 2014-12-17 * https://github.com/TargetProcess/tauCharts * Copyright (c) 2014 Taucraft Limited; Licensed Creative Commons */ -!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)},init:function(b){this._chart=b,this._dataFields=a.fields,c.extend(this,c.omit(a,"fields")),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){var b=a.target;b.classList.contains("i-role-exclude")&&(this._exclude(),this._hide())}.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:e})},this).join("")},onRender:function(){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 h','
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,c.extend(this,c.omit(a,"fields")),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){var b=a.target;b.classList.contains("i-role-exclude")&&(this._exclude(),this._hide())}.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(){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,m.string,j.xScale,j.yScale,j.color.get(g),j.container)});var o=function(a){return function(){var b=e.mouse(this),c=e.select(this);c.classed({active:a,"graphical-report__line-width-1":!a,"graphical-report__line-width-2":a}),c.select(".graphical-report__trendline__tip").attr("x",b[0]+3).attr("y",b[1]-3)}};j.container.selectAll(".graphical-report__trendline").on("mouseenter",o(!0)).on("mouseleave",o(!1))}},containerTemplate:'
',template:d.template(['","
",'","
",'
<%= error %>
',""].join("")),onRender:function(){this._container&&(this._container.innerHTML=this.template({title:"Trend line",showTrend:b.showTrend&&!this.hasError?"checked":"",models:["linear","exponential","logarithmic"].map(function(a){var c=b.type===a?"selected":"";return""}),error:this.error,hideControls:this.hasError?"graphical-report__trendlinepanel__hide":""}))}}}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= winPos.right) { place[1] = "left"; } break; - default: if (target.left + target.width / 2 + this.width / 2 >= winPos.right) { - place[1] = "left"; - } else if (target.right - target.width / 2 - this.width / 2 <= winPos.left) { - place[1] = "right"; - } + default: + if (target.left + target.width / 2 + this.width / 2 >= winPos.right) { + place[1] = "left"; + } else if (target.right - target.width / 2 - this.width / 2 <= winPos.left) { + place[1] = "right"; + } } } else { if (target.left - this.width - spacing <= winPos.left) { @@ -1024,35 +1021,34 @@ define('api/balloon',["exports", "../const"], function (exports, _const) { } switch (place[1]) { case "top": - if (target.bottom - this.height <= winPos.top) { place[1] = "bottom"; } break; case "bottom": - if (target.top + this.height >= winPos.bottom) { place[1] = "top"; } break; - default: if (target.top + target.height / 2 + this.height / 2 >= winPos.bottom) { - place[1] = "top"; - } else if (target.bottom - target.height / 2 - this.height / 2 <= winPos.top) { - place[1] = "bottom"; - } + default: + if (target.top + target.height / 2 + this.height / 2 >= winPos.bottom) { + place[1] = "top"; + } else if (target.bottom - target.height / 2 - this.height / 2 <= winPos.top) { + place[1] = "bottom"; + } } } return place.join("-"); }; - /** - * Position the element to an element or a specific coordinates. - * - * @param {Integer|Element} x - * @param {Integer} y - * - * @return {Tooltip} + /** + * Position the element to an element or a specific coordinates. + * + * @param {Integer|Element} x + * @param {Integer} y + * + * @return {Tooltip} */ Tooltip.prototype.position = function (x, y) { if (this.attachedTo) { @@ -1088,65 +1084,53 @@ define('api/balloon',["exports", "../const"], function (exports, _const) { var top, left; switch (this.curPlace) { case "top": - top = target.top - this.height - spacing; left = target.left + target.width / 2 - this.width / 2; break; case "top-left": - top = target.top - this.height - spacing; left = target.right - this.width; break; case "top-right": - top = target.top - this.height - spacing; left = target.left; break; case "bottom": - top = target.bottom + spacing; left = target.left + target.width / 2 - this.width / 2; break; case "bottom-left": - top = target.bottom + spacing; left = target.right - this.width; break; case "bottom-right": - top = target.bottom + spacing; left = target.left; break; case "left": - top = target.top + target.height / 2 - this.height / 2; left = target.left - this.width - spacing; break; case "left-top": - top = target.bottom - this.height; left = target.left - this.width - spacing; break; case "left-bottom": - top = target.top; left = target.left - this.width - spacing; break; case "right": - top = target.top + target.height / 2 - this.height / 2; left = target.right + spacing; break; case "right-top": - top = target.bottom - this.height; left = target.right + spacing; break; case "right-bottom": - top = target.top; left = target.right + spacing; break; @@ -1159,13 +1143,13 @@ define('api/balloon',["exports", "../const"], function (exports, _const) { return this; }; - /** - * Show the tooltip. - * - * @param {Integer|Element} x - * @param {Integer} y - * - * @return {Tooltip} + /** + * Show the tooltip. + * + * @param {Integer|Element} x + * @param {Integer} y + * + * @return {Tooltip} */ Tooltip.prototype.show = function (x, y) { x = this.attachedTo ? this.attachedTo : x; @@ -1203,10 +1187,10 @@ define('api/balloon',["exports", "../const"], function (exports, _const) { return this.element; }; - /** - * Hide the tooltip. - * - * @return {Tooltip} + /** + * Hide the tooltip. + * + * @return {Tooltip} */ Tooltip.prototype.hide = function () { if (this.hidden) { @@ -1253,10 +1237,10 @@ define('api/balloon',["exports", "../const"], function (exports, _const) { this.element = this.options = null; }; - /** - * Make the tip window resize aware. - * - * @return {Void} + /** + * Make the tip window resize aware. + * + * @return {Void} */ Tooltip.prototype._aware = function () { var index = indexOf(Tooltip.winAware, this); @@ -1265,10 +1249,10 @@ define('api/balloon',["exports", "../const"], function (exports, _const) { } }; - /** - * Remove the window resize awareness. - * - * @return {Void} + /** + * Remove the window resize awareness. + * + * @return {Void} */ Tooltip.prototype._unaware = function () { var index = indexOf(Tooltip.winAware, this); @@ -1277,10 +1261,10 @@ define('api/balloon',["exports", "../const"], function (exports, _const) { } }; - /** - * Handles repositioning of tooltips on window resize. - * - * @return {Void} + /** + * Handles repositioning of tooltips on window resize. + * + * @return {Void} */ Tooltip.reposition = (function () { var rAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) { @@ -1312,17 +1296,17 @@ define('api/balloon',["exports", "../const"], function (exports, _const) { window.addEventListener("resize", Tooltip.reposition); window.addEventListener("scroll", Tooltip.reposition); - /** - * Array with dynamic class types. - * - * @type {Array} + /** + * Array with dynamic class types. + * + * @type {Array} */ Tooltip.classTypes = ["type", "effect"]; - /** - * Default options for Tooltip constructor. - * - * @type {Object} + /** + * Default options for Tooltip constructor. + * + * @type {Object} */ Tooltip.defaults = { baseClass: CSS_PREFIX + "tooltip", // Base tooltip class name. @@ -1341,17 +1325,17 @@ define('event',["exports"], function (exports) { var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); - if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var NULL_HANDLER = {}; var events = {}; - /** - * Creates new type of event or returns existing one, if it was created before. - * @param {string} eventName - * @return {function(..eventArgs)} + + /** + * Creates new type of event or returns existing one, if it was created before. + * @param {string} eventName + * @return {function(..eventArgs)} */ function createDispatcher(eventName) { var eventFunction = events[eventName]; @@ -1406,8 +1390,18 @@ define('event',["exports"], function (exports) { return eventFunction; } + /** + * Base class for event dispatching. It provides interface for instance + * to add and remove handler for desired events, and call it when event happens. + * @class + */ + var Emitter = (function () { - var Emitter = function Emitter() { + var Emitter = + /** + * @constructor + */ + function Emitter() { this.handler = null; this.emit_destroy = createDispatcher("destroy"); }; @@ -1415,6 +1409,13 @@ define('event',["exports"], function (exports) { _classProps(Emitter, null, { addHandler: { writable: true, + + + /** + * Adds new event handler to object. + * @param {object} callbacks Callback set. + * @param {object=} context Context object. + */ value: function (callbacks, context) { context = context || this; // add handler @@ -1442,6 +1443,14 @@ define('event',["exports"], function (exports) { }, removeHandler: { writable: true, + + + /** + * Removes event handler set from object. For this operation parameters + * must be the same (equivalent) as used for addHandler method. + * @param {object} callbacks Callback set. + * @param {object=} context Context object. + */ value: function (callbacks, context) { var cursor = this; var prev; @@ -1461,10 +1470,17 @@ define('event',["exports"], function (exports) { return; } } + + } }, destroy: { writable: true, + + + /** + * @destructor + */ value: function () { // fire object destroy event handlers this.emit_destroy(); @@ -1556,12 +1572,10 @@ define('utils/utils',["exports"], function (exports) { exports.utils = utils; }); -/* jshint ignore:start */ define('formatter-registry',["exports", "d3"], function (exports, _d3) { var d3 = _d3; - /* jshint ignore:end */ var FORMATS_MAP = { "x-num-auto": function (x) { @@ -1614,9 +1628,9 @@ define('formatter-registry',["exports", "d3"], function (exports, _d3) { FORMATS_MAP["x-time-hour"] = FORMATS_MAP["x-time-auto"]; FORMATS_MAP["x-time-day"] = FORMATS_MAP["x-time-auto"]; FORMATS_MAP["x-time-week"] = FORMATS_MAP["x-time-auto"]; - FORMATS_MAP["x-time-month"] = FORMATS_MAP["month"]; - FORMATS_MAP["x-time-quarter"] = FORMATS_MAP["quarter"]; - FORMATS_MAP["x-time-year"] = FORMATS_MAP["year"]; + FORMATS_MAP["x-time-month"] = FORMATS_MAP.month; + FORMATS_MAP["x-time-quarter"] = FORMATS_MAP.quarter; + FORMATS_MAP["x-time-year"] = FORMATS_MAP.year; /* jshint ignore:end */ var FormatterRegistry = { @@ -1662,7 +1676,6 @@ define('utils/utils-draw',["exports", "../utils/utils", "../formatter-registry", var FormatterRegistry = _formatterRegistry.FormatterRegistry; var _ = _underscore; var d3 = _d3; - /* jshint ignore:end */ var translate = function (left, top) { @@ -1675,6 +1688,7 @@ define('utils/utils-draw',["exports", "../utils/utils", "../formatter-registry", return _.contains(["bottom", "top"], scaleOrient.toLowerCase()) ? "h" : "v"; }; + var cutText = function (textString, widthLimit) { textString.each(function () { var textD3 = d3.select(this); @@ -1955,6 +1969,7 @@ define('utils/utils-draw',["exports", "../utils/utils", "../formatter-registry", node.guide.size = extendLabel(node.guide, "size"); node.guide.color = extendLabel(node.guide, "color"); + return node; }; @@ -1977,6 +1992,8 @@ define('spec-engine-factory',["exports", "./utils/utils", "./utils/utils-draw", var utilsDraw = _utilsUtilsDraw.utilsDraw; var FormatterRegistry = _formatterRegistry.FormatterRegistry; + + function extendGuide(guide, targetUnit, dimension, properties) { var guide_dim = guide.hasOwnProperty(dimension) ? guide[dimension] : {}; _.each(properties, function (prop) { @@ -2216,6 +2233,7 @@ define('spec-engine-factory',["exports", "./utils/utils", "./utils/utils-draw", var yMeta = meta.scaleMeta(unit.y, yScaleOptions); var yValues = yMeta.values; + unit.guide.x.tickFormat = unit.guide.x.tickFormat || getTickFormat(dimX, xMeta, settings.defaultFormats); unit.guide.y.tickFormat = unit.guide.y.tickFormat || getTickFormat(dimY, yMeta, settings.defaultFormats); @@ -2226,6 +2244,7 @@ define('spec-engine-factory',["exports", "./utils/utils", "./utils/utils-draw", var maxYTickSize = getMaxTickLabelSize(yValues, FormatterRegistry.get(unit.guide.y.tickFormat, unit.guide.y.tickFormatNullAlias), settings.getAxisTickLabelSize, settings.yAxisTickLabelLimit); + var xAxisPadding = selectorPredicates.isLeafParent ? settings.xAxisPadding : 0; var yAxisPadding = selectorPredicates.isLeafParent ? settings.yAxisPadding : 0; @@ -2271,6 +2290,7 @@ define('spec-engine-factory',["exports", "./utils/utils", "./utils/utils-draw", var distToXAxisLabel = settings.distToXAxisLabel; var distToYAxisLabel = settings.distToYAxisLabel; + var xTickLabelW = Math.min(settings.xAxisTickLabelLimit, (isXVertical ? maxXTickSize.height : maxXTickSize.width)); unit.guide.x.density = settings.xDensityKoeff * xTickLabelW; @@ -2279,12 +2299,15 @@ define('spec-engine-factory',["exports", "./utils/utils", "./utils/utils-draw", var yTickLabelH = Math.min(settings.yAxisTickLabelLimit, koeffLinesCount * maxYTickSize.height); unit.guide.y.density = settings.yDensityKoeff * yTickLabelH; + unit.guide.x.label.padding = (unit.guide.x.label.text) ? (xFontH + distToXAxisLabel) : 0; unit.guide.y.label.padding = (unit.guide.y.label.text) ? (yFontW + distToYAxisLabel) : 0; + var xLabelPadding = (unit.guide.x.label.text) ? (unit.guide.x.label.padding + xFontLabelHeight) : (xFontH); var yLabelPadding = (unit.guide.y.label.text) ? (unit.guide.y.label.padding + yFontLabelHeight) : (yFontW); + unit.guide.padding.b = xAxisPadding + xLabelPadding; unit.guide.padding.l = yAxisPadding + yLabelPadding; @@ -2315,6 +2338,7 @@ define('spec-engine-factory',["exports", "./utils/utils", "./utils/utils-draw", }, srcSpec); }; + var fnTraverseSpec = function (orig, specUnitRef, transformRules) { var xRef = utilsDraw.applyNodeDefaults(specUnitRef); xRef = transformRules(createSelectorPredicates(xRef), xRef); @@ -2400,6 +2424,8 @@ define('layout-engine-factory',["exports", "./utils/utils", "./utils/utils-draw" var utilsDraw = _utilsUtilsDraw.utilsDraw; var TMatrix = _matrix.TMatrix; + + var specUnitSummary = function (spec, boxOpt) { var box = boxOpt ? boxOpt : { depth: -1, paddings: [] }; var p = spec.guide.padding; @@ -2518,20 +2544,21 @@ define('layout-engine-factory',["exports", "./utils/utils", "./utils/utils-draw" exports.LayoutEngineFactory = LayoutEngineFactory; }); -//plugins -/** @class - * @extends Plugin */ define('plugins',["exports"], function (exports) { var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); - if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; + //plugins + /** @class + * @extends Plugin */ var Plugins = (function () { - var Plugins = function Plugins(plugins, chart) { + var Plugins = + /** @constructs */ + function Plugins(plugins, chart) { this.chart = chart; this._plugins = plugins.map(this.initPlugin, this); }; @@ -2541,7 +2568,6 @@ define('plugins',["exports"], function (exports) { writable: true, value: function (plugin) { var _this = this; - if (plugin.init) { plugin.init(this.chart); } @@ -2574,6 +2600,7 @@ define('plugins',["exports"], function (exports) { }; }; + exports.propagateDatumEvents = propagateDatumEvents; exports.Plugins = Plugins; }); @@ -2670,7 +2697,6 @@ define('unit-domain-mixin',["exports", "./unit-domain-period-generator", "./util var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); - if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; @@ -2678,7 +2704,6 @@ define('unit-domain-mixin',["exports", "./unit-domain-period-generator", "./util var utils = _utilsUtils.utils; var _ = _underscore; var d3 = _d3; - /* jshint ignore:end */ var autoScaleMethods = { @@ -2951,6 +2976,7 @@ define('data-processor',["exports", "./utils/utils"], function (exports, _utilsU var utils = _utilsUtils.utils; + var DataProcessor = { isYFunctionOfX: function (data, xFields, yFields) { var isRelationAFunction = true; @@ -3097,7 +3123,6 @@ define('utils/layuot-template',["exports", "../const"], function (exports, _cons var CSS_PREFIX = _const.CSS_PREFIX; - var createElement = function (cssClass, parent) { var tag = "div"; var element = document.createElement(tag); @@ -3129,6 +3154,7 @@ define('utils/layuot-template',["exports", "../const"], function (exports, _cons /* jshint ignore:end */ }; + exports.getLayout = getLayout; }); define('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 (exports, _dslReader, _apiBalloon, _event, _specEngineFactory, _layoutEngineFactory, _plugins, _utilsUtils, _utilsUtilsDom, _const, _unitDomainMixin, _unitsRegistry, _dataProcessor, _utilsLayuotTemplate) { @@ -3136,7 +3162,6 @@ define('charts/tau.plot',["exports", "../dsl-reader", "../api/balloon", "../even var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); - if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; @@ -3167,6 +3192,7 @@ define('charts/tau.plot',["exports", "../dsl-reader", "../api/balloon", "../even var DataProcessor = _dataProcessor.DataProcessor; var getLayout = _utilsLayuotTemplate.getLayout; + var traverseFromDeep = function (root) { var r; @@ -3305,6 +3331,7 @@ define('charts/tau.plot',["exports", "../dsl-reader", "../api/balloon", "../even writable: true, value: function (target, xSize) { this._svg = null; + this._defaultSize = _.clone(xSize); var container = d3.select(target); var containerNode = container.node(); this._target = target; @@ -3317,6 +3344,7 @@ define('charts/tau.plot',["exports", "../dsl-reader", "../api/balloon", "../even container = d3.select(this._layout.content); //todo don't compute width if width or height were passed var size = xSize || {}; + this._layout.content.innerHTML = ""; if (!size.width || !size.height) { size = _.defaults(size, utilsDom.getContainerSize(this._layout.content.parentNode)); } @@ -3353,11 +3381,13 @@ define('charts/tau.plot',["exports", "../dsl-reader", "../api/balloon", "../even size.height = screenH - scrollH; size.width = screenW - scrollW; + // optimize full spec depending on size var localSettings = this.config.settings; traverseToDeep(fullSpec.unit, size, localSettings); + var reader = new DSLReader(domainMixin, UnitsRegistry); var logicXGraph = reader.buildGraph(fullSpec); @@ -3390,7 +3420,7 @@ define('charts/tau.plot',["exports", "../dsl-reader", "../api/balloon", "../even writable: true, value: function (data) { this.config.data = data; - this.renderTo(this._target, this._targetSizes); + this.refresh(); } }, getSVG: { @@ -3407,23 +3437,22 @@ define('charts/tau.plot',["exports", "../dsl-reader", "../api/balloon", "../even var id = this._filtersStore.tick++; filter.id = id; filters.push(filter); - if (this._target && this._targetSizes) { - this.renderTo(this._target, this._targetSizes); - } + this.refresh(); return id; } }, refresh: { writable: true, value: function () { - this.renderTo(this._target, this._targetSizes); + if (this._target) { + this.renderTo(this._target, this._defaultSize); + } } }, resize: { writable: true, value: function (sizes) { if (sizes === undefined) sizes = {}; - this.renderTo(this._target, sizes); } }, @@ -3431,15 +3460,12 @@ define('charts/tau.plot',["exports", "../dsl-reader", "../api/balloon", "../even writable: true, value: function (id) { var _this = this; - _.each(this._filtersStore.filters, function (filters, key) { _this._filtersStore.filters[key] = _.reject(filters, function (item) { return item.id === id; }); }); - if (this._target && this._targetSizes) { - this.renderTo(this._target, this._targetSizes); - } + this.refresh(); } } }); @@ -3468,6 +3494,7 @@ define('charts/tau.chart',["exports", "./tau.plot", "../utils/utils", "../data-p var utils = _utilsUtils.utils; var DataProcessor = _dataProcessor.DataProcessor; + var convertAxis = function (data) { return (!data) ? null : data; }; @@ -3695,6 +3722,7 @@ define('elements/coords',["exports", "../utils/utils-draw", "../const", "../util var utils = _utilsUtils.utils; var TMatrix = _matrix.TMatrix; + var FacetAlgebra = { CROSS: function (root, dimX, dimY) { var domainX = root.domain(dimX); @@ -3868,7 +3896,6 @@ define('elements/point',["exports", "../utils/utils-draw", "../const", "./size"] var utilsDraw = _utilsUtilsDraw.utilsDraw; var CSS_PREFIX = _const.CSS_PREFIX; var sizeScale = _size.sizeScale; - var point = function (node) { var options = node.options; @@ -3908,7 +3935,6 @@ define('utils/css-class-map',["exports", "../const"], function (exports, _const) var CSS_PREFIX = _const.CSS_PREFIX; - var arrayNumber = [1, 2, 3, 4, 5]; var countLineClasses = arrayNumber.map(function (i) { return CSS_PREFIX + "line-opacity-" + i; @@ -3943,7 +3969,6 @@ define('elements/line',["exports", "../utils/utils-draw", "./point", "../const", var CSS_PREFIX = _const.CSS_PREFIX; var getLineClassesByWidth = _utilsCssClassMap.getLineClassesByWidth; var getLineClassesByCount = _utilsCssClassMap.getLineClassesByCount; - var line = function (node) { var options = node.options; @@ -4016,6 +4041,7 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct var utilsDraw = _utilsUtilsDraw.utilsDraw; var CSS_PREFIX = _const.CSS_PREFIX; + var BAR_GROUP = "i-role-bar-group"; var isMeasure = function (dim) { @@ -4056,10 +4082,8 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct var tickWidth; var intervalWidth; var offsetCategory; - (function () { xMin = Math.min.apply(null, xScale.domain()); - var startPoint = (xMin <= 0) ? 0 : xMin; _ref = getSizesParams({ @@ -4071,7 +4095,6 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct tickWidth = _ref.tickWidth; intervalWidth = _ref.intervalWidth; offsetCategory = _ref.offsetCategory; - /* jshint ignore:end */ calculateX = isMeasure(node.x) ? function (d) { return xScale(Math.min(startPoint, d[node.x.scaleDim])); @@ -4097,10 +4120,8 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct var tickWidth; var intervalWidth; var offsetCategory; - (function () { yMin = Math.min.apply(null, yScale.domain()); - var startPoint = (yMin <= 0) ? 0 : yMin; _ref2 = getSizesParams({ @@ -4112,7 +4133,6 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct tickWidth = _ref2.tickWidth; intervalWidth = _ref2.intervalWidth; offsetCategory = _ref2.offsetCategory; - /* jshint ignore:end */ calculateX = function (d) { return xScale(d[node.x.scaleDim]) - (tickWidth / 2); @@ -4169,6 +4189,7 @@ define('elements/coords-parallel',["exports", "../utils/utils-draw", "../const", var utils = _utilsUtils.utils; var TMatrix = _matrix.TMatrix; + var inheritRootProps = function (unit, root, props) { var r = _.defaults(utils.clone(unit), _.pick.apply(_, [root].concat(props))); r.guide = _.extend(utils.clone(root.guide || {}), (r.guide || {})); @@ -4217,6 +4238,7 @@ define('elements/coords-parallel',["exports", "../utils/utils-draw", "../const", var container = options.container.append("g").attr("class", "graphical-report__" + "cell " + "cell").attr("transform", utilsDraw.translate(L, T)); + var translate = function (left, top) { return "translate(" + left + "," + top + ")"; }; @@ -4224,6 +4246,7 @@ define('elements/coords-parallel',["exports", "../utils/utils-draw", "../const", return "rotate(" + angle + ")"; }; + var fnDrawDimAxis = function (xScaleObj, AXIS_POSITION) { var container = this; @@ -4257,6 +4280,7 @@ define('elements/coords-parallel-line',["exports", "../utils/utils-draw", "../co var utilsDraw = _utilsUtilsDraw.utilsDraw; var CSS_PREFIX = _const.CSS_PREFIX; + var CoordsParallelLine = { draw: function (node) { node.color = node.dimension(node.color, node); @@ -4329,6 +4353,7 @@ define('node-map',["exports", "./elements/coords", "./elements/line", "./element var CoordsParallel = _elementsCoordsParallel.CoordsParallel; var CoordsParallelLine = _elementsCoordsParallelLine.CoordsParallelLine; + var setupElementNode = function (node, dimensions) { dimensions.forEach(function (dimName) { node[dimName] = node.dimension(node[dimName], node); @@ -4407,7 +4432,6 @@ define('tau.newCharts',["exports", "./utils/utils-dom", "./charts/tau.plot", "./ var FormatterRegistry = _formatterRegistry.FormatterRegistry; var nodeMap = _nodeMap.nodeMap; var UnitsRegistry = _unitsRegistry.UnitsRegistry; - var colorBrewers = {}; var plugins = {}; @@ -4507,11 +4531,11 @@ define('tau.newCharts',["exports", "./utils/utils-dom", "./charts/tau.plot", "./ exports.__api__ = __api__; exports.api = api; }); - define('underscore',function(){ - return _; - }); - define('d3',function(){ - return d3; - }); - return require('tau.newCharts'); + define('underscore',function(){ + return _; + }); + define('d3',function(){ + return d3; + }); + return require('tau.newCharts'); })); \ No newline at end of file diff --git a/build/tauCharts.min.js b/build/tauCharts.min.js index 12210e2d3..86bb685d7 100644 --- a/build/tauCharts.min.js +++ b/build/tauCharts.min.js @@ -1,5 +1,5 @@ -/*! tauCharts - v0.2.16 - 2014-12-17 +/*! tauCharts - v0.2.17 - 2014-12-17 * https://github.com/TargetProcess/tauCharts * Copyright (c) 2014 Taucraft Limited; Licensed Creative Commons */ !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(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},d=function(){var b=function(a,b){this.domain=a,this.UnitsRegistry=b};return c(b,null,{buildGraph:{writable:!0,value:function(a){var b=this,c=function(a){return b.UnitsRegistry.get(a.type).walk(b.domain.mix(a),c)};return c(a.unit)}},calcLayout:{writable:!0,value:function(b,c){b.options={top:0,left:0,width:c.width,height:c.height};var d=function(b){if(!b.$matrix)return b;var c,e=b.options,f=b.guide.padding,g=e.width-(f.l+f.r),h=e.height-(f.t+f.b),i=b.$matrix.sizeR(),j=b.$matrix.sizeC(),k=g/j,l=h/i;return c=b.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*l}},b.$matrix.iterate(function(b,e,f){var g=f.length;a.each(f,function(a,f){a.options={width:k,left:e*k,height:c.calcHeight(l,b,f,g),top:c.calcTop(l,b,f,g)},d(a)})}),b};return d(b)}},renderGraph:{writable:!0,value:function(a,b,c){var d=this;a.options.container=b;var e=function(a){var b=d.domain.mix(a);d.UnitsRegistry.get(a.type).draw(b,function(b){b.parentUnit=a,e(b)}),c&&c.fire("unitready",b)};return a.parentUnit=null,e(a),a.options.container}}}),b}();b.DSLReader=d}),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=e[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"),week:d.time.format("%d-%b-%Y"),"week-range":function(a){var b=new Date(a),c=new Date(a),e=new Date(c.setDate(c.getDate()+7)),f=d.time.format("%d-%b-%Y");return f(b)+" - "+f(e)},month: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};e["x-time-ms"]=e["x-time-auto"],e["x-time-sec"]=e["x-time-auto"],e["x-time-min"]=e["x-time-auto"],e["x-time-hour"]=e["x-time-auto"],e["x-time-day"]=e["x-time-auto"],e["x-time-week"]=e["x-time-auto"],e["x-time-month"]=e.month,e["x-time-quarter"]=e.quarter,e["x-time-year"]=e.year;var 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){a.each(function(){var a=i.select(this),c=a.text().split(/\s+/).reverse();a.text(null);for(var d,e=[],f=!1;!f&&(d=c.pop());)if(e.push(d),a.text(e.join(" ")),a.node().getComputedTextLength()>b){e.pop();var g=e.join(" ");g+="...",a.text(g),f=!0}})},n=function(a,b,c,d,e){var f=function(a,b,c,d,e,f,g){var h=g*c+f,i=a.append("tspan").attr("x",d).attr("y",e).attr("dy",h+"em").text(b);return i};a.each(function(){var a=i.select(this),g=a.text().split(/\s+/),h=1.1,j=a.attr("x"),k=a.attr("y"),l=parseFloat(a.attr("dy"));a.text(null);var m=f(a,null,h,j,k,l,0),n=!1,o=g.reduce(function(a,d){if(n)return a;var e=a.length===c,f=a[a.length-1],g=m.text(f+d).node().getComputedTextLength()>b;return g&&e&&(a[a.length-1]=f+"...",n=!0),g&&!e&&a.push(d),g||(a[a.length-1]=f+" "+d),a},[""]);k=e?-1*(o.length-1)*Math.floor(.5*d):k,o.forEach(function(b,c){return f(a,b,h,j,k,l,c)}),m.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="h"===l(b.guide.scaleOrient)?1:-1,d=a.append("text").attr("transform",k(b.guide.label.rotate)).attr("class","label").attr("x",c*b.guide.size*.5).attr("y",c*b.guide.label.padding).style("text-anchor",b.guide.label.textAnchor),e=" > ",f=b.guide.label.text.split(e),g=f.length;f.forEach(function(a,b){d.append("tspan").attr("class","label-token label-token-"+b).text(a),g-1>b&&d.append("tspan").attr("class","label-token-delimiter label-token-delimiter-"+b).text(e)})},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"}),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};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={NONE:function(a,b,c){var d=g.clone(a);return p(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.map(function(a){return a.toUpperCase()}).join(" > ")),h&&(h.guide.y.label.text=e.map(function(a){return a.toUpperCase()}).join(" > ")),c},"BUILD-GUIDE":function(a,b,c){var d=g.clone(a);return p(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={map:d.guide.x.tickLabel,min:d.guide.x.tickMin,max:d.guide.x.tickMax,period:d.guide.x.tickPeriod,autoScale:d.guide.x.autoScale},l={map:d.guide.y.tickLabel,min:d.guide.y.tickMin,max:d.guide.y.tickMax,period:d.guide.y.tickPeriod,autoScale:d.guide.y.autoScale},o=b.scaleMeta(d.x,k),p=o.values,q=b.scaleMeta(d.y,l),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=c.xDensityKoeff*J;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=c.yDensityKoeff*M,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}};o.AUTO=function(a,b,c){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(a,d){return o[d](a,b,c)},a)};var p=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 p(g.clone(a),k(a,f),d)}),e},q={get:function(a,b){var c=o[a]||o.NONE;return function(a,d){return c(a,d,b)}}};b.SpecEngineFactory=q}),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(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},d=function(){var a=function(a,b){this.chart=b,this._plugins=a.map(this.initPlugin,this)};return c(a,null,{initPlugin:{writable:!0,value:function(a){var b=this;a.init&&a.init(this.chart),this.chart.on("destroy",a.destroy||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}(),e=["click","mouseover","mouseout","mousemove"],f=function(a){return function(){e.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=f,a.Plugins=d}),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=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},g=b.UnitDomainPeriodGenerator,h=c.utils,i=d,j=e,k={ordinal:function(a){return a},linear:function(a,b){var c=b.autoScale?h.autoScale(a):j.extent(a),d=i.isNumber(b.min)?b.min:c[0],e=i.isNumber(b.max)?b.max:c[1];return[Math.min(d,c[0]),Math.max(e,c[1])]},period:function(a,b){var c=j.extent(a),d=i.isNull(b.min)||i.isUndefined(b.min)?c[0]:new Date(b.min).getTime(),e=i.isNull(b.max)||i.isUndefined(b.max)?c[1]:new Date(b.max).getTime(),f=[new Date(Math.min(d,c[0])),new Date(Math.max(e,c[1]))]; -return g.generate(f[0],f[1],b.period)},time:function(a,b){var c=j.extent(a),d=i.isNull(b.min)||i.isUndefined(b.min)?c[0]:new Date(b.min).getTime(),e=i.isNull(b.max)||i.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]))]}},l={ordinal:function(a,b){return j.scale.ordinal().domain(a).rangePoints(b,1)},linear:function(a,b){return j.scale.linear().domain(a).rangeRound(b,1)},period:function(a,b){return j.scale.ordinal().domain(a).rangePoints(b,1)},time:function(a,b){return j.time.scale().domain(a).range(b)}},m=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=i.contains(["period","time"],d.scale);return f?i.compose(function(a){return new Date(a).getTime()},e):e},e=function(b){var c=a[b]||{};return c.order||null},f=function(a){var b={category:function(a,b,c){return c},order:function(a,b,c){var d=e(a);return d?i.union(d,c):i.sortBy(c,b)},measure:function(a,b,c){return i.sortBy(c,b)},"as-is":function(a,b,c){return c}};return b[a]||b["as-is"]},h=function(a){var b={category:f("category"),order:f("order"),measure:f("measure"),"as-is":f("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=i.map(a,function(a,b){return function(c){return d(b)(c[b])===a}});return i(b).filter(function(a){return i.every(c,function(b){return b(a)})})};var j=function(c,e){if(!a[c])return[null];var f=d(c),g=i(b).chain().pluck(c).uniq(f).value();return e(c,f,g)};this.fnDomain=function(b){var c=d(b),e=(a[b]||{}).type,g=j(b,f(e));return g.map(c)};var m=function(b,e){var f=e||{},l=i.defaults({},a[b]),m={"order:period":function(a){return function(b){return g.get(a.period).cast(new Date(b))}},"*":function(){return function(a){return a}}},n=f.map?c(f.map):d(b),o=[l.type,l.scale].join(":"),p=(m[o]||m["*"])(f),q=j(b,h(l.type)).map(n),r=l.scale?k[l.scale](q,f):[];return{extract:function(a){return p(n(a))},values:r,source:q}};this.fnScaleMeta=m,this.fnScaleTo=function(b,c,d){var e=d||{},f=i.defaults({},a[b]),g=m(b,d),h=l[f.scale](g.values,c,e),j=function(a){return h(g.extract(a))};return Object.keys(h).forEach(function(a){return j[a]=h[a]}),j}};return f(a,null,{mix:{writable:!0,value: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 j.nest().key(function(a){return a[b]}).entries(a)},a}}}),a}();a.UnitDomainMixin=m}),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,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},r=function(a,b){a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),a.__proto__=b},s=d.DSLReader,t=e.Tooltip,u=f.Emitter,v=g.SpecEngineFactory,w=h.LayoutEngineFactory,x=i.Plugins,y=i.propagateDatumEvents,z=j.utils,A=k.utilsDom,B=l.CSS_PREFIX,C=m.UnitDomainMixin,D=n.UnitsRegistry,E=o.DataProcessor,F=p.getLayout,G=function(a){var b;if(a.unit){var c=G(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},H=function(a,b,c){var d=a.guide.x.$minimalDomain||1,e=a.guide.y.$minimalDomain||1,f=b.width/d,g=b.height/e,h=c.xMinimumDensityKoeff;if(a.guide.x.hide!==!0&&0!==a.guide.x.rotate&&f>h*a.guide.x.$maxTickTextW){a.guide.x.rotate=0,a.guide.x.textAnchor="middle",a.guide.x.tickFormatWordWrapLimit=f;var i=Math.min(c.xAxisTickLabelLimit,a.guide.x.$maxTickTextW),j=0-i+a.guide.x.$maxTickTextH;a.guide.x.label.padding=a.guide.x.label.padding>0?a.guide.x.label.padding+j:a.guide.x.label.padding,a.guide.padding.b=a.guide.padding.b>0?a.guide.padding.b+j:a.guide.padding.b}var k={width:f,height:g};a.unit&&H(a.unit[0],k,c)},I=function(c){var d=function(a){c.call(this),this._svg=null,this._filtersStore={filters:{},tick:0},this._layout=F(),this.setupConfig(a),this._plugins=new x(this.config.plugins,this)};return r(d,c),q(d,null,{setupConfig:{writable:!0,value: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),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:E.excludeNullValues(this.config.spec.dimensions,function(a){c([a,"point was excluded, because it has undefined values."],"WARN")})})}},getConfig:{writable:!0,value:function(){return this.config}},setupMetaInfo:{writable:!0,value:function(a,b){var c=a?a:E.autoDetectDimTypes(b);return E.autoAssignScales(c)}},setupSettings:{writable:!0,value:function(b){var c=d.globalSettings,e={};return Object.keys(c).forEach(function(b){e[b]=a.isFunction(c[b])?c[b]:z.clone(c[b])}),a.defaults(b||{},e)}},insertToRightSidebar:{writable:!0,value:function(a){return A.appendTo(a,this._layout.rightSidebar)}},addBalloon:{writable:!0,value:function(a){return new t("",a||{})}},renderTo:{writable:!0,value:function(c,d){this._svg=null;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||{};g.width&&g.height||(g=a.defaults(g,A.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 C(this.config.spec.dimensions,h),j=v.get(this.config.settings.specEngine,this.config.settings),k=j(this.config.spec,i.mix({})),l=G(k.unit),m=l.w,n=l.h,o=A.getScrollbarWidth(),p=g.width-m,q=g.height-n,r=p>=0?g.width:m,t=q>=0?0:o,u=q>=0?g.height:n,x=p>=0?0:o;g.height=u-x,g.width=r-t;var z=this.config.settings;H(k.unit,g,z);var E=new s(i,D),F=E.buildGraph(k),I=w.get(this.config.settings.layoutEngine)(F),J=E.calcLayout(I,g),K=E.renderGraph(J,e.append("svg").attr("class",B+"svg").attr("width",g.width).attr("height",g.height),this);this._svg=K.node(),K.selectAll(".i-role-datum").call(y(this)),this._layout.rightSidebar.style.maxHeight=g.height+"px",this.fire("render",this._svg)}},getData:{writable:!0,value: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}))}},setData:{writable:!0,value:function(a){this.config.data=a,this.renderTo(this._target,this._targetSizes)}},getSVG:{writable:!0,value:function(){return this._svg}},addFilter:{writable:!0,value: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._target&&this._targetSizes&&this.renderTo(this._target,this._targetSizes),d}},refresh:{writable:!0,value:function(){this.renderTo(this._target,this._targetSizes)}},resize:{writable:!0,value:function(a){void 0===a&&(a={}),this.renderTo(this._target,a)}},removeFilter:{writable:!0,value: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._target&&this._targetSizes&&this.renderTo(this._target,this._targetSizes)}}}),d}(u);c.Plot=I}),e("charts/tau.chart",["exports","./tau.plot","../utils/utils","../data-processor"],function(b,c,d,e){function f(a,b){return b.reduce(function(b,c,d){return"measure"===a[c].type&&(b.countMeasureAxis++,b.indexMeasureAxis.push(d)),"measure"!==a[c].type&&1===b.countMeasureAxis?b.status=o.WARNING:b.countMeasureAxis>1&&(b.status=o.FAIL),b},{status:o.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[]})}function g(b,c){var d=m(c.x),e=m(c.y),g=f(c.dimensions,d),h=f(c.dimensions,e);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(){throw new Error("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(a){var b=function(b){b.settings=this.setupSettings(b.settings),b.dimensions=this.setupMetaInfo(b.dimensions,b.data),a.call(this,q[b.type](b))};return h(b,a),b}(i);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(b,c){var d=b.options,e=b.guide.padding;b.x.guide=b.guide.x,b.y.guide=b.guide.y;var f=d.left+e.l,i=d.top+e.t,j=d.width-(e.l+e.r),k=d.height-(e.t+e.b),l={map:b.x.guide.tickLabel,min:b.x.guide.tickMin,max:b.x.guide.tickMax,period:b.x.guide.tickPeriod,autoScale:b.x.guide.autoScale};b.x.scaleObj=b.x.scaleDim&&b.scaleTo(b.x.scaleDim,[0,j],l);var m={map:b.y.guide.tickLabel,min:b.y.guide.tickMin,max:b.y.guide.tickMax,period:b.y.guide.tickPeriod,autoScale:b.y.guide.autoScale};b.y.scaleObj=b.y.scaleDim&&b.scaleTo(b.y.scaleDim,[k,0],m),b.x.guide.size=j,b.y.guide.size=k;var n=[0,k+b.guide.x.padding],o=[0-b.guide.y.padding,0],p=d.container.append("g").attr("class",h+"cell cell").attr("transform",g.translate(f,i)).datum({$where:b.$where});b.x.guide.hide||g.fnDrawDimAxis.call(p,b.x,n,j),b.y.guide.hide||g.fnDrawDimAxis.call(p,b.y,o,k);var q=g.fnDrawGrid.call(p,b,k,j);b.$matrix.iterate(function(b,d,e){e.forEach(function(b){b.options=a.extend({container:q},b.options),c(b)})})}};b.coords=n}),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("elements/point",["exports","../utils/utils-draw","../const","./size"],function(b,c,d,e){var f=(c.utilsDraw,d.CSS_PREFIX),g=e.sizeScale,h=function(b){var c=b.options,d=c.xScale,e=c.yScale,h=c.color,i=.5*a.min([b.guide.x.tickFontHeight,b.guide.y.tickFontHeight].filter(function(a){return 0!==a})),j=.5*a.min([b.guide.x.density,b.guide.y.density].filter(function(a){return 0!==a})),k=g(b.domain(b.size.scaleDim),2,j,i),l=function(){return this.attr("r",function(a){return k(a[b.size.scaleDim])}).attr("cx",function(a){return d(a[b.x.scaleDim])}).attr("cy",function(a){return e(a[b.y.scaleDim])}).attr("class",function(a){return f+"dot dot i-role-datum "+h.get(a[h.dimension])})},m=c.container.selectAll(".dot").data(b.partition());m.call(l),m.exit().remove(),m.enter().append("circle").call(l)};b.point=h}),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","../utils/utils-draw","./point","../const","../utils/css-class-map"],function(a,c,d,e,f){var g=(c.utilsDraw,d.point,e.CSS_PREFIX),h=f.getLineClassesByWidth,i=f.getLineClassesByCount,j=function(a){var c=a.options,d=c.xScale,e=c.yScale,f=c.color;a.size={};var j=a.groupBy(a.partition(),f.dimension),k=h(c.width),l=i(j.length),m=function(){this.attr("class",function(a){return[g+"line i-role-datum ","line",f.get(a.key),k,l].join(" ")});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 h=b.reduce(function(a,b){var c=b.values;return 1===c.length&&a.push(c[0]),a},[]),i=function(){return this.attr("r",1.5).attr("class",function(a){return g+"dot-line dot-line i-role-datum "+g+"dot i-role-datum "+f.get(a[f.dimension])}).attr("cx",function(b){return d(b[a.x.scaleDim])}).attr("cy",function(b){return e(b[a.y.scaleDim])})},j=c.container.selectAll(".dot-line").data(h);j.call(i),j.exit().remove(),j.enter().append("circle").call(i)},o=b.svg.line().x(function(b){return d(b[a.x.scaleDim])}).y(function(b){return e(b[a.y.scaleDim])}),p=function(){this.attr("d",o)};n(j);var q=c.container.selectAll(".line").data(j);q.call(m),q.enter().append("g").call(m),q.exit().remove()};a.line=j}),e("elements/interval",["exports","../utils/utils-draw","../const"],function(a,b,c){var d=b.utilsDraw,e=c.CSS_PREFIX,f="i-role-bar-group",g=function(a){return"measure"===a.dimType},h=function(a){var b,c,d;return g(a.dim)?(b=5,c=5,d=0):(b=a.size/a.domain().length,c=b/(a.categories.length+1),d=c),{tickWidth:b,intervalWidth:c,offsetCategory:d}},i=function(a){var b,c,i,j,k,l=a.options,m=l.xScale,n=l.yScale,o=l.color,p=a.groupBy(a.partition(),o.dimension);if(a.flip){var q,r,s,t,u;!function(){q=Math.min.apply(null,m.domain());var e=0>=q?0:q;r=h({domain:n.domain,dim:a.y,categories:p,size:l.height}),s=r.tickWidth,t=r.intervalWidth,u=r.offsetCategory,b=g(a.x)?function(b){return m(Math.min(e,b[a.x.scaleDim]))}:0,c=function(b){return n(b[a.y.scaleDim])-s/2},i=g(a.x)?function(b){return Math.abs(m(b[a.x.scaleDim])-m(e))}:function(b){return m(b[a.x.scaleDim])},j=function(){return t},k=function(a,b){return d.translate(0,b*u+u/2)}}()}else{var v,w,s,t,u;!function(){v=Math.min.apply(null,n.domain());var e=0>=v?0:v;w=h({domain:m.domain,dim:a.x,categories:p,size:l.width}),s=w.tickWidth,t=w.intervalWidth,u=w.offsetCategory,b=function(b){return m(b[a.x.scaleDim])-s/2},c=g(a.y)?function(b){return n(Math.max(e,b[a.y.scaleDim]))}:function(b){return n(b[a.y.scaleDim])},i=function(){return t},j=g(a.y)?function(b){return Math.abs(n(b[a.y.scaleDim])-n(e))}:function(b){return l.height-n(b[a.y.scaleDim])},k=function(a,b){return d.translate(b*u+u/2,0)}}()}var x=function(){return this.attr("class",function(a){return"i-role-datum bar "+e+"bar "+o.get(a[o.dimension])}).attr("x",b).attr("y",c).attr("width",i).attr("height",j)},y=function(){this.attr("class",f).attr("transform",k);var a=this.selectAll("bar").data(function(a){return a.values});a.call(x),a.enter().append("rect").call(x),a.exit().remove()},z=l.container.selectAll("."+f).data(p);z.call(y),z.enter().append("g").call(y),z.exit().remove()};a.interval=i}),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(c,d){var e=c.options,f=c.guide.padding,g=e.left+f.l,i=e.top+f.t,j=e.width-(f.l+f.r),k=e.height-(f.t+f.b),l=c.x.map(function(a){return c.scaleTo(a,[k,0],{})}),m=e.container.append("g").attr("class","graphical-report__cell cell").attr("transform",h.translate(g,i)),n=function(a,b){return"translate("+a+","+b+")"},o=function(a){return"rotate("+a+")"},p=function(a,c){var d=this,e=b.svg.axis().scale(a).orient("left"),f=d.append("g").attr("class","y axis").attr("transform",n.apply(null,c)).call(e);f.selectAll(".tick text").attr("transform",o(0)).style("text-anchor","end")},q=j/(c.x.length-1);l.forEach(function(a,b){p.call(m,a,[b*q,0])});var r=m.append("g").attr("class","grid").attr("transform",n(0,0));c.$matrix.iterate(function(b,c,e){e.forEach(function(b){b.options=a.extend({container:r},b.options),d(b)})})}};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("node-map",["exports","./elements/coords","./elements/line","./elements/point","./elements/interval","./utils/utils-draw","./elements/coords-parallel","./elements/coords-parallel-line"],function(a,b,c,d,e,f,g,h){var i=b.coords,j=c.line,k=d.point,l=e.interval,m=f.utilsDraw,n=g.CoordsParallel,o=h.CoordsParallelLine,p=function(a,b){b.forEach(function(b){a[b]=a.dimension(a[b],a)});var c=a.options,d=c.width,e=c.height;a.x.guide=a.guide.x,a.y.guide=a.guide.y;var f={map:a.x.guide.tickLabel,min:a.x.guide.tickMin,max:a.x.guide.tickMax,period:a.x.guide.tickPeriod,autoScale:a.x.guide.autoScale};a.options.xScale=a.x.scaleDim&&a.scaleTo(a.x.scaleDim,[0,d],f);var g={map:a.y.guide.tickLabel,min:a.y.guide.tickMin,max:a.y.guide.tickMax,period:a.y.guide.tickPeriod,autoScale:a.y.guide.autoScale};return a.options.yScale=a.y.scaleDim&&a.scaleTo(a.y.scaleDim,[e,0],g),a.options.color=m.generateColor(a),a},q={"COORDS.RECT":{walk:i.walk,draw:function(a,b){a.x=a.dimension(a.x,a),a.y=a.dimension(a.y,a),i.draw(a,b)}},"ELEMENT.POINT":function(a){k(p(a,["x","y","color","size"]))},"ELEMENT.LINE":function(a){j(p(a,["x","y","color"]))},"ELEMENT.INTERVAL":function(a){l(p(a,["x","y","color"]))},"COORDS.PARALLEL":n,"PARALLEL/ELEMENT.LINE":o};a.nodeMap=q}),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:"AUTO",layoutEngine:"EXTRACT",getAxisTickLabelSize:o.getAxisTickLabelSize,xAxisTickLabelLimit:100,yAxisTickLabelLimit:100,xTickWordWrapLinesLimit:2,yTickWordWrapLinesLimit:3,xTickWidth:9,yTickWidth:9,distToXAxisLabel:20,distToYAxisLabel:20,xAxisPadding:20,yAxisPadding:20,xFontLabelHeight:15,yFontLabelHeight:15,xDensityKoeff:2.2,xMinimumDensityKoeff:1.1,yDensityKoeff:2.2,yMinimumDensityKoeff:1.1,defaultFormats:{measure:"x-num-auto","measure:time":"x-time-auto","measure:time:year":"x-time-year","measure:time:quarter":"x-time-quarter","measure:time:month":"x-time-month","measure:time:week":"x-time-week","measure:time:day":"x-time-day","measure:time:hour":"x-time-hour","measure:time:min":"x-time-min","measure:time:sec":"x-time-sec","measure:time:ms":"x-time-ms"}}};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")}); \ No newline at end of file +return g.generate(f[0],f[1],b.period)},time:function(a,b){var c=j.extent(a),d=i.isNull(b.min)||i.isUndefined(b.min)?c[0]:new Date(b.min).getTime(),e=i.isNull(b.max)||i.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]))]}},l={ordinal:function(a,b){return j.scale.ordinal().domain(a).rangePoints(b,1)},linear:function(a,b){return j.scale.linear().domain(a).rangeRound(b,1)},period:function(a,b){return j.scale.ordinal().domain(a).rangePoints(b,1)},time:function(a,b){return j.time.scale().domain(a).range(b)}},m=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=i.contains(["period","time"],d.scale);return f?i.compose(function(a){return new Date(a).getTime()},e):e},e=function(b){var c=a[b]||{};return c.order||null},f=function(a){var b={category:function(a,b,c){return c},order:function(a,b,c){var d=e(a);return d?i.union(d,c):i.sortBy(c,b)},measure:function(a,b,c){return i.sortBy(c,b)},"as-is":function(a,b,c){return c}};return b[a]||b["as-is"]},h=function(a){var b={category:f("category"),order:f("order"),measure:f("measure"),"as-is":f("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=i.map(a,function(a,b){return function(c){return d(b)(c[b])===a}});return i(b).filter(function(a){return i.every(c,function(b){return b(a)})})};var j=function(c,e){if(!a[c])return[null];var f=d(c),g=i(b).chain().pluck(c).uniq(f).value();return e(c,f,g)};this.fnDomain=function(b){var c=d(b),e=(a[b]||{}).type,g=j(b,f(e));return g.map(c)};var m=function(b,e){var f=e||{},l=i.defaults({},a[b]),m={"order:period":function(a){return function(b){return g.get(a.period).cast(new Date(b))}},"*":function(){return function(a){return a}}},n=f.map?c(f.map):d(b),o=[l.type,l.scale].join(":"),p=(m[o]||m["*"])(f),q=j(b,h(l.type)).map(n),r=l.scale?k[l.scale](q,f):[];return{extract:function(a){return p(n(a))},values:r,source:q}};this.fnScaleMeta=m,this.fnScaleTo=function(b,c,d){var e=d||{},f=i.defaults({},a[b]),g=m(b,d),h=l[f.scale](g.values,c,e),j=function(a){return h(g.extract(a))};return Object.keys(h).forEach(function(a){return j[a]=h[a]}),j}};return f(a,null,{mix:{writable:!0,value: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 j.nest().key(function(a){return a[b]}).entries(a)},a}}}),a}();a.UnitDomainMixin=m}),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,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},r=function(a,b){a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),a.__proto__=b},s=d.DSLReader,t=e.Tooltip,u=f.Emitter,v=g.SpecEngineFactory,w=h.LayoutEngineFactory,x=i.Plugins,y=i.propagateDatumEvents,z=j.utils,A=k.utilsDom,B=l.CSS_PREFIX,C=m.UnitDomainMixin,D=n.UnitsRegistry,E=o.DataProcessor,F=p.getLayout,G=function(a){var b;if(a.unit){var c=G(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},H=function(a,b,c){var d=a.guide.x.$minimalDomain||1,e=a.guide.y.$minimalDomain||1,f=b.width/d,g=b.height/e,h=c.xMinimumDensityKoeff;if(a.guide.x.hide!==!0&&0!==a.guide.x.rotate&&f>h*a.guide.x.$maxTickTextW){a.guide.x.rotate=0,a.guide.x.textAnchor="middle",a.guide.x.tickFormatWordWrapLimit=f;var i=Math.min(c.xAxisTickLabelLimit,a.guide.x.$maxTickTextW),j=0-i+a.guide.x.$maxTickTextH;a.guide.x.label.padding=a.guide.x.label.padding>0?a.guide.x.label.padding+j:a.guide.x.label.padding,a.guide.padding.b=a.guide.padding.b>0?a.guide.padding.b+j:a.guide.padding.b}var k={width:f,height:g};a.unit&&H(a.unit[0],k,c)},I=function(c){var d=function(a){c.call(this),this._svg=null,this._filtersStore={filters:{},tick:0},this._layout=F(),this.setupConfig(a),this._plugins=new x(this.config.plugins,this)};return r(d,c),q(d,null,{setupConfig:{writable:!0,value: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),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:E.excludeNullValues(this.config.spec.dimensions,function(a){c([a,"point was excluded, because it has undefined values."],"WARN")})})}},getConfig:{writable:!0,value:function(){return this.config}},setupMetaInfo:{writable:!0,value:function(a,b){var c=a?a:E.autoDetectDimTypes(b);return E.autoAssignScales(c)}},setupSettings:{writable:!0,value:function(b){var c=d.globalSettings,e={};return Object.keys(c).forEach(function(b){e[b]=a.isFunction(c[b])?c[b]:z.clone(c[b])}),a.defaults(b||{},e)}},insertToRightSidebar:{writable:!0,value:function(a){return A.appendTo(a,this._layout.rightSidebar)}},addBalloon:{writable:!0,value:function(a){return new t("",a||{})}},renderTo:{writable:!0,value:function(c,d){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,A.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 C(this.config.spec.dimensions,h),j=v.get(this.config.settings.specEngine,this.config.settings),k=j(this.config.spec,i.mix({})),l=G(k.unit),m=l.w,n=l.h,o=A.getScrollbarWidth(),p=g.width-m,q=g.height-n,r=p>=0?g.width:m,t=q>=0?0:o,u=q>=0?g.height:n,x=p>=0?0:o;g.height=u-x,g.width=r-t;var z=this.config.settings;H(k.unit,g,z);var E=new s(i,D),F=E.buildGraph(k),I=w.get(this.config.settings.layoutEngine)(F),J=E.calcLayout(I,g),K=E.renderGraph(J,e.append("svg").attr("class",B+"svg").attr("width",g.width).attr("height",g.height),this);this._svg=K.node(),K.selectAll(".i-role-datum").call(y(this)),this._layout.rightSidebar.style.maxHeight=g.height+"px",this.fire("render",this._svg)}},getData:{writable:!0,value: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}))}},setData:{writable:!0,value:function(a){this.config.data=a,this.refresh()}},getSVG:{writable:!0,value:function(){return this._svg}},addFilter:{writable:!0,value: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}},refresh:{writable:!0,value:function(){this._target&&this.renderTo(this._target,this._defaultSize)}},resize:{writable:!0,value:function(a){void 0===a&&(a={}),this.renderTo(this._target,a)}},removeFilter:{writable:!0,value: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}(u);c.Plot=I}),e("charts/tau.chart",["exports","./tau.plot","../utils/utils","../data-processor"],function(b,c,d,e){function f(a,b){return b.reduce(function(b,c,d){return"measure"===a[c].type&&(b.countMeasureAxis++,b.indexMeasureAxis.push(d)),"measure"!==a[c].type&&1===b.countMeasureAxis?b.status=o.WARNING:b.countMeasureAxis>1&&(b.status=o.FAIL),b},{status:o.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[]})}function g(b,c){var d=m(c.x),e=m(c.y),g=f(c.dimensions,d),h=f(c.dimensions,e);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(){throw new Error("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(a){var b=function(b){b.settings=this.setupSettings(b.settings),b.dimensions=this.setupMetaInfo(b.dimensions,b.data),a.call(this,q[b.type](b))};return h(b,a),b}(i);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(b,c){var d=b.options,e=b.guide.padding;b.x.guide=b.guide.x,b.y.guide=b.guide.y;var f=d.left+e.l,i=d.top+e.t,j=d.width-(e.l+e.r),k=d.height-(e.t+e.b),l={map:b.x.guide.tickLabel,min:b.x.guide.tickMin,max:b.x.guide.tickMax,period:b.x.guide.tickPeriod,autoScale:b.x.guide.autoScale};b.x.scaleObj=b.x.scaleDim&&b.scaleTo(b.x.scaleDim,[0,j],l);var m={map:b.y.guide.tickLabel,min:b.y.guide.tickMin,max:b.y.guide.tickMax,period:b.y.guide.tickPeriod,autoScale:b.y.guide.autoScale};b.y.scaleObj=b.y.scaleDim&&b.scaleTo(b.y.scaleDim,[k,0],m),b.x.guide.size=j,b.y.guide.size=k;var n=[0,k+b.guide.x.padding],o=[0-b.guide.y.padding,0],p=d.container.append("g").attr("class",h+"cell cell").attr("transform",g.translate(f,i)).datum({$where:b.$where});b.x.guide.hide||g.fnDrawDimAxis.call(p,b.x,n,j),b.y.guide.hide||g.fnDrawDimAxis.call(p,b.y,o,k);var q=g.fnDrawGrid.call(p,b,k,j);b.$matrix.iterate(function(b,d,e){e.forEach(function(b){b.options=a.extend({container:q},b.options),c(b)})})}};b.coords=n}),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("elements/point",["exports","../utils/utils-draw","../const","./size"],function(b,c,d,e){var f=(c.utilsDraw,d.CSS_PREFIX),g=e.sizeScale,h=function(b){var c=b.options,d=c.xScale,e=c.yScale,h=c.color,i=.5*a.min([b.guide.x.tickFontHeight,b.guide.y.tickFontHeight].filter(function(a){return 0!==a})),j=.5*a.min([b.guide.x.density,b.guide.y.density].filter(function(a){return 0!==a})),k=g(b.domain(b.size.scaleDim),2,j,i),l=function(){return this.attr("r",function(a){return k(a[b.size.scaleDim])}).attr("cx",function(a){return d(a[b.x.scaleDim])}).attr("cy",function(a){return e(a[b.y.scaleDim])}).attr("class",function(a){return f+"dot dot i-role-datum "+h.get(a[h.dimension])})},m=c.container.selectAll(".dot").data(b.partition());m.call(l),m.exit().remove(),m.enter().append("circle").call(l)};b.point=h}),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","../utils/utils-draw","./point","../const","../utils/css-class-map"],function(a,c,d,e,f){var g=(c.utilsDraw,d.point,e.CSS_PREFIX),h=f.getLineClassesByWidth,i=f.getLineClassesByCount,j=function(a){var c=a.options,d=c.xScale,e=c.yScale,f=c.color;a.size={};var j=a.groupBy(a.partition(),f.dimension),k=h(c.width),l=i(j.length),m=function(){this.attr("class",function(a){return[g+"line i-role-datum ","line",f.get(a.key),k,l].join(" ")});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 h=b.reduce(function(a,b){var c=b.values;return 1===c.length&&a.push(c[0]),a},[]),i=function(){return this.attr("r",1.5).attr("class",function(a){return g+"dot-line dot-line i-role-datum "+g+"dot i-role-datum "+f.get(a[f.dimension])}).attr("cx",function(b){return d(b[a.x.scaleDim])}).attr("cy",function(b){return e(b[a.y.scaleDim])})},j=c.container.selectAll(".dot-line").data(h);j.call(i),j.exit().remove(),j.enter().append("circle").call(i)},o=b.svg.line().x(function(b){return d(b[a.x.scaleDim])}).y(function(b){return e(b[a.y.scaleDim])}),p=function(){this.attr("d",o)};n(j);var q=c.container.selectAll(".line").data(j);q.call(m),q.enter().append("g").call(m),q.exit().remove()};a.line=j}),e("elements/interval",["exports","../utils/utils-draw","../const"],function(a,b,c){var d=b.utilsDraw,e=c.CSS_PREFIX,f="i-role-bar-group",g=function(a){return"measure"===a.dimType},h=function(a){var b,c,d;return g(a.dim)?(b=5,c=5,d=0):(b=a.size/a.domain().length,c=b/(a.categories.length+1),d=c),{tickWidth:b,intervalWidth:c,offsetCategory:d}},i=function(a){var b,c,i,j,k,l=a.options,m=l.xScale,n=l.yScale,o=l.color,p=a.groupBy(a.partition(),o.dimension);if(a.flip){var q,r,s,t,u;!function(){q=Math.min.apply(null,m.domain());var e=0>=q?0:q;r=h({domain:n.domain,dim:a.y,categories:p,size:l.height}),s=r.tickWidth,t=r.intervalWidth,u=r.offsetCategory,b=g(a.x)?function(b){return m(Math.min(e,b[a.x.scaleDim]))}:0,c=function(b){return n(b[a.y.scaleDim])-s/2},i=g(a.x)?function(b){return Math.abs(m(b[a.x.scaleDim])-m(e))}:function(b){return m(b[a.x.scaleDim])},j=function(){return t},k=function(a,b){return d.translate(0,b*u+u/2)}}()}else{var v,w,s,t,u;!function(){v=Math.min.apply(null,n.domain());var e=0>=v?0:v;w=h({domain:m.domain,dim:a.x,categories:p,size:l.width}),s=w.tickWidth,t=w.intervalWidth,u=w.offsetCategory,b=function(b){return m(b[a.x.scaleDim])-s/2},c=g(a.y)?function(b){return n(Math.max(e,b[a.y.scaleDim]))}:function(b){return n(b[a.y.scaleDim])},i=function(){return t},j=g(a.y)?function(b){return Math.abs(n(b[a.y.scaleDim])-n(e))}:function(b){return l.height-n(b[a.y.scaleDim])},k=function(a,b){return d.translate(b*u+u/2,0)}}()}var x=function(){return this.attr("class",function(a){return"i-role-datum bar "+e+"bar "+o.get(a[o.dimension])}).attr("x",b).attr("y",c).attr("width",i).attr("height",j)},y=function(){this.attr("class",f).attr("transform",k);var a=this.selectAll("bar").data(function(a){return a.values});a.call(x),a.enter().append("rect").call(x),a.exit().remove()},z=l.container.selectAll("."+f).data(p);z.call(y),z.enter().append("g").call(y),z.exit().remove()};a.interval=i}),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(c,d){var e=c.options,f=c.guide.padding,g=e.left+f.l,i=e.top+f.t,j=e.width-(f.l+f.r),k=e.height-(f.t+f.b),l=c.x.map(function(a){return c.scaleTo(a,[k,0],{})}),m=e.container.append("g").attr("class","graphical-report__cell cell").attr("transform",h.translate(g,i)),n=function(a,b){return"translate("+a+","+b+")"},o=function(a){return"rotate("+a+")"},p=function(a,c){var d=this,e=b.svg.axis().scale(a).orient("left"),f=d.append("g").attr("class","y axis").attr("transform",n.apply(null,c)).call(e);f.selectAll(".tick text").attr("transform",o(0)).style("text-anchor","end")},q=j/(c.x.length-1);l.forEach(function(a,b){p.call(m,a,[b*q,0])});var r=m.append("g").attr("class","grid").attr("transform",n(0,0));c.$matrix.iterate(function(b,c,e){e.forEach(function(b){b.options=a.extend({container:r},b.options),d(b)})})}};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("node-map",["exports","./elements/coords","./elements/line","./elements/point","./elements/interval","./utils/utils-draw","./elements/coords-parallel","./elements/coords-parallel-line"],function(a,b,c,d,e,f,g,h){var i=b.coords,j=c.line,k=d.point,l=e.interval,m=f.utilsDraw,n=g.CoordsParallel,o=h.CoordsParallelLine,p=function(a,b){b.forEach(function(b){a[b]=a.dimension(a[b],a)});var c=a.options,d=c.width,e=c.height;a.x.guide=a.guide.x,a.y.guide=a.guide.y;var f={map:a.x.guide.tickLabel,min:a.x.guide.tickMin,max:a.x.guide.tickMax,period:a.x.guide.tickPeriod,autoScale:a.x.guide.autoScale};a.options.xScale=a.x.scaleDim&&a.scaleTo(a.x.scaleDim,[0,d],f);var g={map:a.y.guide.tickLabel,min:a.y.guide.tickMin,max:a.y.guide.tickMax,period:a.y.guide.tickPeriod,autoScale:a.y.guide.autoScale};return a.options.yScale=a.y.scaleDim&&a.scaleTo(a.y.scaleDim,[e,0],g),a.options.color=m.generateColor(a),a},q={"COORDS.RECT":{walk:i.walk,draw:function(a,b){a.x=a.dimension(a.x,a),a.y=a.dimension(a.y,a),i.draw(a,b)}},"ELEMENT.POINT":function(a){k(p(a,["x","y","color","size"]))},"ELEMENT.LINE":function(a){j(p(a,["x","y","color"]))},"ELEMENT.INTERVAL":function(a){l(p(a,["x","y","color"]))},"COORDS.PARALLEL":n,"PARALLEL/ELEMENT.LINE":o};a.nodeMap=q}),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:"AUTO",layoutEngine:"EXTRACT",getAxisTickLabelSize:o.getAxisTickLabelSize,xAxisTickLabelLimit:100,yAxisTickLabelLimit:100,xTickWordWrapLinesLimit:2,yTickWordWrapLinesLimit:3,xTickWidth:9,yTickWidth:9,distToXAxisLabel:20,distToYAxisLabel:20,xAxisPadding:20,yAxisPadding:20,xFontLabelHeight:15,yFontLabelHeight:15,xDensityKoeff:2.2,xMinimumDensityKoeff:1.1,yDensityKoeff:2.2,yMinimumDensityKoeff:1.1,defaultFormats:{measure:"x-num-auto","measure:time":"x-time-auto","measure:time:year":"x-time-year","measure:time:quarter":"x-time-quarter","measure:time:month":"x-time-month","measure:time:week":"x-time-week","measure:time:day":"x-time-day","measure:time:hour":"x-time-hour","measure:time:min":"x-time-min","measure:time:sec":"x-time-sec","measure:time:ms":"x-time-ms"}}};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")}); \ No newline at end of file diff --git a/component.json b/component.json index bdd8d0091..6ba51bd6f 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "tauCharts", - "version": "0.2.16", + "version": "0.2.17", "ignore": [ "/*", "!build/**", diff --git a/package.json b/package.json index eaa914b00..9079df2ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tauCharts", - "version": "0.2.16", + "version": "0.2.17", "homepage": "https://github.com/TargetProcess/tauCharts", "description": "Simple charts library based on d3", "author": {