text: (window.webpackJsonp=window.webpackJsonp||[]).push([[45],{1694:function(t,e,r){"use strict";var n,a=r(54),i=(n=a)&&n.__esModule?n:{default:n},o=r(31),d=r(244);r(3231),i.default.hierarchy=r(2806).hierarchy,i.default.partition=r(2806).partition,t.exports=function(t,e){var r=e.data,n=t.formData,a=i.default.select(t.selector),l=n.metrics||[],s=n.log_scale||!1,c=n.time_series_option||"not_time",u=["adv_anal","time_series"].indexOf(c)>=0,p=i.default.format(n.number_format),h=(0,o.d3TimeFormatPreset)(n.date_time_format);a.selectAll("*").remove(),i.default.selectAll(".nvtooltip").remove();var f=i.default.select("body").append("div").attr("class","nvtooltip").style("opacity",0).style("top",0).style("left",0).style("position","fixed");function m(e,o){var c=o[e],m=t.width(),g=t.height()/r.length,v=i.default.scale.linear().range([0,m]),y=i.default.scale.linear().range([0,g]),x=a.append("div").attr("class","chart").style("width",m+"px").style("height",g+"px").append("svg:svg").attr("width",m).attr("height",g);e!==r.length-1&&r.length>1&&x.style("padding-bottom","3px"),0!==e&&r.length>1&&x.style("padding-top","3px");var _=i.default.hierarchy(c);function w(t){return l.indexOf(t.data.name)>=0&&u}_.eachAfter((function(t){t.disp=t.data.val,t.value=t.disp<0?-t.disp:t.disp,t.weight=t.value,t.name=t.data.name,t.parent&&w(t.parent)&&(t.weight=n.equal_date_size?1:t.value,t.value=t.name,t.name=h(t.name)),s&&(t.weight=Math.log(t.weight+1)),t.disp=t.disp&&!isNaN(t.disp)&&isFinite(t.disp)?p(t.disp):""})),_.sort((function(t,e){var r=e.value-t.value;return 0===r?e.name>t.name?1:-1:r})),n.partition_threshold&&n.partition_threshold>=0&&_.each((function(t){if(t.sum=t.children&&t.children.reduce((function(t,e){return t+e.weight}),0)||1,t.children)if(w(t)){if(n.equal_date_size)return;for(var e=[],r=1;r<t.children.length;r++)t.children[r].weight/t.sum<n.partition_threshold&&e.push(r);for(var a=e.length-1;a>=0;a--)t.children.splice(e[a],1)}else{var i=void 0;for(i=1;i<t.children.length&&!(t.children[i].weight/t.sum<n.partition_threshold);i++);t.children=t.children.slice(0,i)}})),n.partition_limit&&n.partition_limit>=0&&_.each((function(t){t.children&&t.children.length>n.partition_limit&&(w(t)||(t.children=t.children.slice(0,n.partition_limit)))})),_.eachAfter((function(t){t.sum=t.children&&t.children.reduce((function(t,e){return t+e.weight}),0)||1}));var b=t.datasource.verbose_map;function k(t){if(!t)return"Metric";if(u&&1===t)return"Date";var e=n.groupby[t-(u?2:1)];return b[e]||e}function A(t,e){var r="<table>";n.rich_tooltip?function(t){for(var e=[t],r=t;r.parent;)e.push(r.parent),r=r.parent;return e}(e).forEach((function(t){var n=t.depth===e.depth;r+="<tbody>",r+="<tr class='"+(n?"emph":"")+"'><td class='legend-color-guide' style='opacity: "+(n?"1":"0.75")+"'><div style='border: 2px solid "+(n?"black":"transparent")+";background-color: "+t.color+";'></div></td><td>"+t.name+"</td><td>"+t.disp+"</td><td>"+k(t.depth)+"</td></tr>"})):(r+="<thead><tr><td colspan=\"3\"><strong class='x-value'>"+k(e.depth)+"</strong></td></tr></thead><tbody>",r+='<tr class="emph"><td class="legend-color-guide" style="opacity: 0.75"><div style=\'border: thin solid grey; background-color: '+e.color+";'></div></td><td>"+e.name+"</td><td>"+e.disp+"</td></tr>");r+="</tbody></table>",t.html(r).style("left",i.default.event.pageX+13+"px").style("top",i.default.event.pageY-10+"px")}var F=x.selectAll("g").data(function(t){var e=[],r=1/(t.height+1),n=null;return t.each((function(t){t.y=r*t.depth,t.dy=r,t.parent?(t.x=n.depth===t.parent.depth?0:n.x+n.dx,t.dx=t.weight/t.parent.sum*t.parent.dx):(t.x=0,t.dx=1),n=t,e.push(t)})),e}(_)).enter().append("svg:g").attr("transform",(function(t){return"translate("+v(t.y)+","+y(t.x)+")"})).on("click",(function t(e){if(!e.children)return!!e.parent&&t(e.parent);M=(e.y?m-40:m)/(1-e.y),q=g/e.dx,v.domain([e.y,1]).range([e.y?40:0,m]),y.domain([e.x,e.x+e.dx]);var r=F.transition().duration(i.default.event.altKey?7500:750).attr("transform",(function(t){return"translate("+v(t.y)+","+y(t.x)+")"}));return r.select("rect").attr("width",e.dy*M).attr("height",(function(t){return t.dx*q})),r.select("text").attr("transform",z).style("opacity",(function(t){return t.dx*q>12?1:0})),i.default.event.stopPropagation(),!0})).on("mouseover",(function(t){f.interrupt().transition().duration(100).style("opacity",.9),A(f,t)})).on("mousemove",(function(t){A(f,t)})).on("mouseout",(function(){f.interrupt().transition().duration(250).style("opacity",0)})),M=m/_.dx,q=g/1;function z(t){return"translate(8,"+t.dx*q/2+")"}F.append("svg:rect").attr("width",_.dy*M).attr("height",(function(t){return t.dx*q})),F.append("svg:text").attr("transform",z).attr("dy","0.35em").style("opacity",(function(t){return t.dx*q>12?1:0})).text((function(t){return t.disp?t.name+": "+t.disp:t.name})),F.selectAll("rect").style("fill",(function(t){return t.color=(0,d.getColorFromScheme)(t.name,n.color_scheme),t.color}))}for(var g=0;g<r.length;g++)m(g,r)}},3231:function(t,e,r){}}]);