d3-flame-graph
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -408,3 +408,3 @@ (function() { | ||
function injectIds(node) { | ||
node.id = s4(); | ||
node.id = s4() + "-" + s4() + "-" + "-" + s4() + "-" + s4(); | ||
var children = node.c || node.children || []; | ||
@@ -411,0 +411,0 @@ for (var i = 0; i < children.length; i++) { |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";function n(){function t(t){return t.data.n||t.data.name}function n(t){return t.c||t.children}function r(t){return t.v||t.value}function e(t){var n=document.getElementById("details");n&&(n.innerHTML=t)}function i(t){var n=0,r=1,e=0,i=10,a=6;if(t){for(var u=0;u<t.length&&!(u>a);u++)n+=r*(t.charCodeAt(u)%i),e+=r*(i-1),r*=.7;e>0&&(n/=e)}return n}function a(t){var n=0;if(t){var r=t.split("`");r.length>1&&(t=r[r.length-1]),t=t.split("(")[0],n=i(t)}var e=200+Math.round(55*n),a=0+Math.round(230*(1-n)),u=0+Math.round(55*(1-n));return"rgb("+e+","+a+","+u+")"}function u(t){t.data.original||(t.data.original=r(t)),t.data.v=0,t.data.value&&delete t.data.value,n(t)&&n(t).forEach(u)}function o(t){t.data.fade=!1,t.data.original&&(t.data.v=t.data.original),n(t)&&n(t).forEach(o)}function c(t){var n=[];if(t.parent){var r=t.parent.children.indexOf(t);n=t.parent.children.slice(0),n.splice(r,1)}return n}function f(t){var n=c(t);n.forEach(function(t){u(t)}),t.parent&&f(t.parent)}function l(t){t.parent&&(t.parent.data.fade=!0,l(t.parent))}function h(t){B.hide(t),f(t),o(t),l(t),v(),"function"==typeof H&&H(t)}function d(r,e){function i(r){var e=t(r);n(r)&&n(r).forEach(function(t){i(t)}),e.match(a)?(r.highlight=!0,u.push(r)):r.highlight=!1}var a=new RegExp(e),u=[];return i(r),u}function s(t){t.highlight=!1,n(t)&&n(t).forEach(function(t){s(t)})}function g(n,r){return"function"==typeof L?L(n,r):L?d3.ascending(t(n),t(r)):void 0}function p(t){var n=t.descendants();if(S>0){var r=b/(t.x1-t.x0);n=n.filter(function(t){return(t.x1-t.x0)*r>S})}return n}function v(){O.each(function(i){function a(t){return(t.x1-t.x0)*c}var u=d3.scaleLinear().range([0,b]),o=d3.scaleLinear().range([0,M]);L&&i.sort(g),i.sum(function(t){if(t.fade)return 0;var e=r(t)||0;if(n(t))for(var i=n(t),a=0;a<i.length;a++)e-=i[a].value;return e}),G(i);var c=b/(i.x1-i.x0),f=p(i),l=d3.select(this).select("svg").selectAll("g").data(f,function(t){return t.id});l.transition().duration(k).ease(C).attr("transform",function(t){return"translate("+u(t.x0)+","+(z?o(t.depth):A-o(t.depth)-M)+")"}),l.select("rect").attr("width",a);var d=l.enter().append("svg:g").attr("transform",function(t){return"translate("+u(t.x0)+","+(z?o(t.depth):A-o(t.depth)-M)+")"});d.append("svg:rect").transition().delay(k/2).attr("width",a),T||d.append("svg:title"),d.append("foreignObject").append("xhtml:div"),l=d3.select(this).select("svg").selectAll("g").data(f,function(t){return t.id}),l.attr("width",a).attr("height",function(t){return M}).attr("name",function(n){return t(n)}).attr("class",function(t){return t.data.fade?"frame fade":"frame"}),l.select("rect").attr("height",function(t){return M}).attr("fill",function(t){return F(t)}),T||l.select("title").text(D),l.select("foreignObject").attr("width",a).attr("height",function(t){return M}).select("div").attr("class","label").style("display",function(t){return a(t)<35?"none":"block"}).transition().delay(k).text(t),l.on("click",h),l.exit().remove(),l.on("mouseover",function(t){T&&B.show(t),e(D(t))}).on("mouseout",function(t){T&&B.hide(t),e("")})})}function m(n,r){r.forEach(function(r){var e=n.find(function(n){return t(n)===t(r)});e?(e.original?e.original+=r.value:e.value+=r.value,r.children&&(e.children||(e.children=[]),m(e.children,r.children))):n.push(r)})}function y(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function x(t){t.id=y();for(var n=t.c||t.children||[],r=0;r<n.length;r++)x(n[r])}function w(t){var r=d3.hierarchy(t.datum(),function(t){return n(t)});return x(r),O=t.datum(r),arguments.length?(A||(A=(r.height+2)*M),O.each(function(t){E||(E=d3.select(this).append("svg:svg").attr("width",b).attr("height",A).attr("class","partition d3-flame-graph").call(B),E.append("svg:text").attr("class","title").attr("text-anchor","middle").attr("y","25").attr("x",b/2).attr("fill","#808080").text(j))}),void v()):w}var E,b=960,A=null,M=18,O=null,T=!0,j="",k=750,C=d3.easeCubic,L=!1,z=!1,H=null,S=0,B=d3.tip().direction("s").offset([8,0]).attr("class","d3-flame-graph-tip").html(function(t){return D(t)}),D=function(n){return t(n)+" ("+d3.format(".3f")(100*(n.x1-n.x0),3)+"%, "+r(n)+" samples)"},F=function(n){return n.highlight?"#E600E6":a(t(n))},G=d3.partition();return w.height=function(t){return arguments.length?(A=t,w):A},w.width=function(t){return arguments.length?(b=t,w):b},w.cellHeight=function(t){return arguments.length?(M=t,w):M},w.tooltip=function(t){return arguments.length?("function"==typeof t&&(B=t),T=!!t,w):T},w.title=function(t){return arguments.length?(j=t,w):j},w.transitionDuration=function(t){return arguments.length?(k=t,w):k},w.transitionEase=function(t){return arguments.length?(C=t,w):C},w.sort=function(t){return arguments.length?(L=t,w):L},w.reversed=function(t){return arguments.length?(z=t,w):z},w.label=function(t){return arguments.length?(D=t,w):D},w.search=function(t){var n=[];return O.each(function(r){n=d(r,t),v()}),n},w.clear=function(){O.each(function(t){s(t),v()})},w.zoomTo=function(t){h(t)},w.resetZoom=function(){O.each(function(t){h(t)})},w.onClick=function(t){return arguments.length?(H=t,w):H},w.merge=function(t){var r;O.each(function(e){m([e.data],[t]),r=d3.hierarchy(e.data,function(t){return n(t)})}),O=O.datum(r),v()},w.color=function(t){return arguments.length?(F=t,w):F},w.minFrameSize=function(t){return arguments.length?(S=t,w):S},w}Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=arguments[1],i=0;r>i;){var a=n[i];if(t.call(e,a,i,n))return a;i++}return void 0}}),Array.prototype.filter||(Array.prototype.filter=function(n,r){if("function"!=typeof n||!this)throw new TypeError;var e=this.length>>>0,i=new Array(e),a=0,u=-1;if(void 0===r)for(;++u!==e;)if(u in this)if(n(t[u],u,t))i[a++]=t[u];else for(;++u!==e;)u in this&&n.call(r,t[u],u,t)&&(i[a++]=t[u]);return i.length=a,i}),"undefined"!=typeof module&&module.exports?module.exports=n:d3.flameGraph=n}(); | ||
!function(){"use strict";function n(){function t(t){return t.data.n||t.data.name}function n(t){return t.c||t.children}function r(t){return t.v||t.value}function e(t){var n=document.getElementById("details");n&&(n.innerHTML=t)}function i(t){var n=0,r=1,e=0,i=10,a=6;if(t){for(var u=0;u<t.length&&!(u>a);u++)n+=r*(t.charCodeAt(u)%i),e+=r*(i-1),r*=.7;e>0&&(n/=e)}return n}function a(t){var n=0;if(t){var r=t.split("`");r.length>1&&(t=r[r.length-1]),t=t.split("(")[0],n=i(t)}var e=200+Math.round(55*n),a=0+Math.round(230*(1-n)),u=0+Math.round(55*(1-n));return"rgb("+e+","+a+","+u+")"}function u(t){t.data.original||(t.data.original=r(t)),t.data.v=0,t.data.value&&delete t.data.value,n(t)&&n(t).forEach(u)}function o(t){t.data.fade=!1,t.data.original&&(t.data.v=t.data.original),n(t)&&n(t).forEach(o)}function c(t){var n=[];if(t.parent){var r=t.parent.children.indexOf(t);n=t.parent.children.slice(0),n.splice(r,1)}return n}function f(t){var n=c(t);n.forEach(function(t){u(t)}),t.parent&&f(t.parent)}function l(t){t.parent&&(t.parent.data.fade=!0,l(t.parent))}function h(t){B.hide(t),f(t),o(t),l(t),v(),"function"==typeof H&&H(t)}function d(r,e){function i(r){var e=t(r);n(r)&&n(r).forEach(function(t){i(t)}),e.match(a)?(r.highlight=!0,u.push(r)):r.highlight=!1}var a=new RegExp(e),u=[];return i(r),u}function s(t){t.highlight=!1,n(t)&&n(t).forEach(function(t){s(t)})}function g(n,r){return"function"==typeof L?L(n,r):L?d3.ascending(t(n),t(r)):void 0}function p(t){var n=t.descendants();if(S>0){var r=b/(t.x1-t.x0);n=n.filter(function(t){return(t.x1-t.x0)*r>S})}return n}function v(){O.each(function(i){function a(t){return(t.x1-t.x0)*c}var u=d3.scaleLinear().range([0,b]),o=d3.scaleLinear().range([0,M]);L&&i.sort(g),i.sum(function(t){if(t.fade)return 0;var e=r(t)||0;if(n(t))for(var i=n(t),a=0;a<i.length;a++)e-=i[a].value;return e}),G(i);var c=b/(i.x1-i.x0),f=p(i),l=d3.select(this).select("svg").selectAll("g").data(f,function(t){return t.id});l.transition().duration(k).ease(C).attr("transform",function(t){return"translate("+u(t.x0)+","+(z?o(t.depth):A-o(t.depth)-M)+")"}),l.select("rect").attr("width",a);var d=l.enter().append("svg:g").attr("transform",function(t){return"translate("+u(t.x0)+","+(z?o(t.depth):A-o(t.depth)-M)+")"});d.append("svg:rect").transition().delay(k/2).attr("width",a),T||d.append("svg:title"),d.append("foreignObject").append("xhtml:div"),l=d3.select(this).select("svg").selectAll("g").data(f,function(t){return t.id}),l.attr("width",a).attr("height",function(t){return M}).attr("name",function(n){return t(n)}).attr("class",function(t){return t.data.fade?"frame fade":"frame"}),l.select("rect").attr("height",function(t){return M}).attr("fill",function(t){return F(t)}),T||l.select("title").text(D),l.select("foreignObject").attr("width",a).attr("height",function(t){return M}).select("div").attr("class","label").style("display",function(t){return a(t)<35?"none":"block"}).transition().delay(k).text(t),l.on("click",h),l.exit().remove(),l.on("mouseover",function(t){T&&B.show(t),e(D(t))}).on("mouseout",function(t){T&&B.hide(t),e("")})})}function m(n,r){r.forEach(function(r){var e=n.find(function(n){return t(n)===t(r)});e?(e.original?e.original+=r.value:e.value+=r.value,r.children&&(e.children||(e.children=[]),m(e.children,r.children))):n.push(r)})}function y(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function x(t){t.id=y()+"-"+y()+"--"+y()+"-"+y();for(var n=t.c||t.children||[],r=0;r<n.length;r++)x(n[r])}function w(t){var r=d3.hierarchy(t.datum(),function(t){return n(t)});return x(r),O=t.datum(r),arguments.length?(A||(A=(r.height+2)*M),O.each(function(t){E||(E=d3.select(this).append("svg:svg").attr("width",b).attr("height",A).attr("class","partition d3-flame-graph").call(B),E.append("svg:text").attr("class","title").attr("text-anchor","middle").attr("y","25").attr("x",b/2).attr("fill","#808080").text(j))}),void v()):w}var E,b=960,A=null,M=18,O=null,T=!0,j="",k=750,C=d3.easeCubic,L=!1,z=!1,H=null,S=0,B=d3.tip().direction("s").offset([8,0]).attr("class","d3-flame-graph-tip").html(function(t){return D(t)}),D=function(n){return t(n)+" ("+d3.format(".3f")(100*(n.x1-n.x0),3)+"%, "+r(n)+" samples)"},F=function(n){return n.highlight?"#E600E6":a(t(n))},G=d3.partition();return w.height=function(t){return arguments.length?(A=t,w):A},w.width=function(t){return arguments.length?(b=t,w):b},w.cellHeight=function(t){return arguments.length?(M=t,w):M},w.tooltip=function(t){return arguments.length?("function"==typeof t&&(B=t),T=!!t,w):T},w.title=function(t){return arguments.length?(j=t,w):j},w.transitionDuration=function(t){return arguments.length?(k=t,w):k},w.transitionEase=function(t){return arguments.length?(C=t,w):C},w.sort=function(t){return arguments.length?(L=t,w):L},w.reversed=function(t){return arguments.length?(z=t,w):z},w.label=function(t){return arguments.length?(D=t,w):D},w.search=function(t){var n=[];return O.each(function(r){n=d(r,t),v()}),n},w.clear=function(){O.each(function(t){s(t),v()})},w.zoomTo=function(t){h(t)},w.resetZoom=function(){O.each(function(t){h(t)})},w.onClick=function(t){return arguments.length?(H=t,w):H},w.merge=function(t){var r;O.each(function(e){m([e.data],[t]),r=d3.hierarchy(e.data,function(t){return n(t)})}),O=O.datum(r),v()},w.color=function(t){return arguments.length?(F=t,w):F},w.minFrameSize=function(t){return arguments.length?(S=t,w):S},w}Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=arguments[1],i=0;r>i;){var a=n[i];if(t.call(e,a,i,n))return a;i++}return void 0}}),Array.prototype.filter||(Array.prototype.filter=function(n,r){if("function"!=typeof n||!this)throw new TypeError;var e=this.length>>>0,i=new Array(e),a=0,u=-1;if(void 0===r)for(;++u!==e;)if(u in this)if(n(t[u],u,t))i[a++]=t[u];else for(;++u!==e;)u in this&&n.call(r,t[u],u,t)&&(i[a++]=t[u]);return i.length=a,i}),"undefined"!=typeof module&&module.exports?module.exports=n:d3.flameGraph=n}(); |
{ | ||
"name": "d3-flame-graph", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A d3.js library to produce flame graphs.", | ||
@@ -5,0 +5,0 @@ "main": "src/d3.flame.js", |
@@ -408,3 +408,3 @@ (function() { | ||
function injectIds(node) { | ||
node.id = s4(); | ||
node.id = s4() + "-" + s4() + "-" + "-" + s4() + "-" + s4(); | ||
var children = node.c || node.children || []; | ||
@@ -411,0 +411,0 @@ for (var i = 0; i < children.length; i++) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11398109