d3-flame-graph
Advanced tools
Comparing version 2.0.0-alpha4 to 2.0.0-alpha5
@@ -435,3 +435,3 @@ (function (global, factory) { | ||
hue = 'red'; | ||
if (name.match(/::/)) { | ||
if (typeof name !== 'undefined' && name && name.match(/::/)) { | ||
hue = 'yellow'; | ||
@@ -563,3 +563,3 @@ } | ||
if (label.match(re)) { | ||
if (typeof label !== 'undefined' && label && label.match(re)) { | ||
d.highlight = true; | ||
@@ -566,0 +566,0 @@ searchResults.push(d); |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3")):"function"==typeof define&&define.amd?define(["exports","d3"],n):n(t.d3=t.d3||{},t.d3)}(this,function(t,n){"use strict";var e="default"in n?n.default:n,r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var o,i=(function(t){!function(n,r){if(t.exports){var o=e;t.exports=r(o)}else n.d3.tip=r(n.d3)}(r,function(t){return function(){var n=function(){return"n"},e=function(){return[0,0]},r=function(){return" "},o=s(),i=null,a=null,u=null;function f(t){var n;i="svg"===(n=(n=t).node()).tagName.toLowerCase()?n:n.ownerSVGElement,a=i.createSVGPoint(),document.body.appendChild(o)}f.show=function(){var t=Array.prototype.slice.call(arguments);t[t.length-1]instanceof SVGElement&&(u=t.pop());var o,i=r.apply(this,t),a=e.apply(this,t),s=n.apply(this,t),h=d(),p=c.length,g=document.documentElement.scrollTop||document.body.scrollTop,v=document.documentElement.scrollLeft||document.body.scrollLeft;for(h.html(i).style("opacity",1).style("pointer-events","all");p--;)h.classed(c[p],!1);return o=l.get(s).apply(this),h.classed(s,!0).style("top",o.top+a[0]+g+"px").style("left",o.left+a[1]+v+"px"),f},f.hide=function(){return d().style("opacity",0).style("pointer-events","none"),f},f.attr=function(n,e){if(arguments.length<2&&"string"==typeof n)return d().attr(n);var r=Array.prototype.slice.call(arguments);return t.selection.prototype.attr.apply(d(),r),f},f.style=function(n,e){if(arguments.length<2&&"string"==typeof n)return d().style(n);var r=Array.prototype.slice.call(arguments);return t.selection.prototype.style.apply(d(),r),f},f.direction=function(t){return arguments.length?(n=null==t?t:p(t),f):n},f.offset=function(t){return arguments.length?(e=null==t?t:p(t),f):e},f.html=function(t){return arguments.length?(r=null==t?t:p(t),f):r},f.destroy=function(){return o&&(d().remove(),o=null),f};var l=t.map({n:function(){var t=h();return{top:t.n.y-o.offsetHeight,left:t.n.x-o.offsetWidth/2}},s:function(){var t=h();return{top:t.s.y,left:t.s.x-o.offsetWidth/2}},e:function(){var t=h();return{top:t.e.y-o.offsetHeight/2,left:t.e.x}},w:function(){var t=h();return{top:t.w.y-o.offsetHeight/2,left:t.w.x-o.offsetWidth}},nw:function(){var t=h();return{top:t.nw.y-o.offsetHeight,left:t.nw.x-o.offsetWidth}},ne:function(){var t=h();return{top:t.ne.y-o.offsetHeight,left:t.ne.x}},sw:function(){var t=h();return{top:t.sw.y,left:t.sw.x-o.offsetWidth}},se:function(){var t=h();return{top:t.se.y,left:t.e.x}}}),c=l.keys();function s(){var n=t.select(document.createElement("div"));return n.style("position","absolute").style("top",0).style("opacity",0).style("pointer-events","none").style("box-sizing","border-box"),n.node()}function d(){return null===o&&(o=s(),document.body.appendChild(o)),t.select(o)}function h(){for(var n=u||t.event.target;void 0===n.getScreenCTM&&"undefined"===n.parentNode;)n=n.parentNode;var e={},r=n.getScreenCTM(),o=n.getBBox(),i=o.width,f=o.height,l=o.x,c=o.y;return a.x=l,a.y=c,e.nw=a.matrixTransform(r),a.x+=i,e.ne=a.matrixTransform(r),a.y+=f,e.se=a.matrixTransform(r),a.x-=i,e.sw=a.matrixTransform(r),a.y-=f/2,e.w=a.matrixTransform(r),a.x+=i,e.e=a.matrixTransform(r),a.x-=i/2,a.y-=f/2,e.n=a.matrixTransform(r),a.y+=f,e.s=a.matrixTransform(r),e}function p(t){return"function"==typeof t?t:function(){return t}}return f}})}(o={exports:{}},o.exports),o.exports);t.flamegraph=function(){var t,e=960,r=null,o=18,a=null,u=!0,f="",l=750,c=n.easeCubic,s=!1,d=!1,h=null,p=0,g=null,v=i().direction("s").offset([8,0]).attr("class","d3-flame-graph-tip").html(function(t){return w(t)});function y(t){return t.data.n||t.data.name}function m(t){return t.c||t.children}function x(t){return t.v||t.value}var w=function(t){return y(t)+" ("+n.format(".3f")(100*(t.x1-t.x0),3)+"%, "+x(t)+" samples)"};function b(t){g&&(g.innerHTML=t)}var M=function(t){return t.highlight?"#E600E6":function(t,n){var e,r,o,i;void 0===n||""===n?i="warm":(i="red",t.match(/::/)&&(i="yellow"),"kernel"===n?i="orange":"jit"===n?i="green":"inlined"===n&&(i="aqua"));var a=0;if(t){var u=t.split("`");u.length>1&&(t=u[u.length-1]),t=t.split("(")[0],a=function(t){var n=0,e=0,r=1;if(t){for(var o=0;o<t.length&&!(o>6);o++)n+=r*(t.charCodeAt(o)%10),e+=9*r,r*=.7;e>0&&(n/=e)}return n}(t)}return"red"===i?(e=200+Math.round(55*a),r=50+Math.round(80*a),o=r):"orange"===i?(e=190+Math.round(65*a),r=90+Math.round(65*a),o=0):"yellow"===i?(e=175+Math.round(55*a),r=e,o=50+Math.round(20*a)):"green"===i?(e=50+Math.round(60*a),r=200+Math.round(55*a),o=e):"aqua"===i?(e=50+Math.round(60*a),r=165+Math.round(55*a),o=r):(e=200+Math.round(55*a),r=0+Math.round(230*(1-a)),o=0+Math.round(55*(1-a))),"rgb("+e+","+r+","+o+")"}(y(t),function(t){return t.data.l||t.data.libtype}(t))};function E(t){t.data.hide=!0,m(t)&&m(t).forEach(E)}function T(t){t.data.fade=!1,t.data.hide=!1,m(t)&&m(t).forEach(T)}function C(t){v.hide(t),function t(n){(function(t){var n=[];if(t.parent){var e=t.parent.children.indexOf(t);(n=t.parent.children.slice(0)).splice(e,1)}return n})(n).forEach(function(t){E(t)}),n.parent&&t(n.parent)}(t),T(t),function t(n){n.parent&&(n.parent.data.fade=!0,t(n.parent))}(t),A(),"function"==typeof h&&h(t)}function H(t,e){return"function"==typeof s?s(t,e):s?n.ascending(y(t),y(e)):void 0}var S=n.partition();function A(){a.each(function(t){var i=n.scaleLinear().range([0,e]),a=n.scaleLinear().range([0,o]);s&&t.sort(H),t.sum(function(t){if(t.fade||t.hide)return 0;var n=x(t);if(m(t))for(var e=m(t),r=0;r<e.length;r++)n-=x(e[r]);return n}),S(t);var f=e/(t.x1-t.x0);function h(t){return(t.x1-t.x0)*f}var g=function(t){var n=t.descendants();if(p>0){var r=e/(t.x1-t.x0);n=n.filter(function(t){return(t.x1-t.x0)*r>p})}return n}(t),E=n.select(this).select("svg").selectAll("g").data(g,function(t){return t.id});E.transition().duration(l).ease(c).attr("transform",function(t){return"translate("+i(t.x0)+","+(d?a(t.depth):r-a(t.depth)-o)+")"}),E.select("rect").attr("width",h);var T=E.enter().append("svg:g").attr("transform",function(t){return"translate("+i(t.x0)+","+(d?a(t.depth):r-a(t.depth)-o)+")"});T.append("svg:rect").transition().delay(l/2).attr("width",h),u||T.append("svg:title"),T.append("foreignObject").append("xhtml:div"),(E=n.select(this).select("svg").selectAll("g").data(g,function(t){return t.id})).attr("width",h).attr("height",function(t){return o}).attr("name",function(t){return y(t)}).attr("class",function(t){return t.data.fade?"frame fade":"frame"}),E.select("rect").attr("height",function(t){return o}).attr("fill",function(t){return M(t)}),u||E.select("title").text(w),E.select("foreignObject").attr("width",h).attr("height",function(t){return o}).select("div").attr("class","d3-flame-graph-label").style("display",function(t){return h(t)<35?"none":"block"}).transition().delay(l).text(y),E.on("click",C),E.exit().remove(),E.on("mouseover",function(t){u&&v.show(t,this),b(w(t))}).on("mouseout",function(t){u&&v.hide(t),b("")})})}function L(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function j(t){t.id=L()+"-"+L()+"--"+L()+"-"+L();for(var n=t.c||t.children||[],e=0;e<n.length;e++)j(n[e])}function k(i){var u=n.hierarchy(i.datum(),function(t){return m(t)});if(j(u),a=i.datum(u),!arguments.length)return k;r||(r=(u.height+2)*o),a.each(function(o){t||(t=n.select(this).append("svg:svg").attr("width",e).attr("height",r).attr("class","partition d3-flame-graph").call(v)).append("svg:text").attr("class","title").attr("text-anchor","middle").attr("y","25").attr("x",e/2).attr("fill","#808080").text(f)}),A()}return k.height=function(t){return arguments.length?(r=t,k):r},k.width=function(t){return arguments.length?(e=t,k):e},k.cellHeight=function(t){return arguments.length?(o=t,k):o},k.tooltip=function(t){return arguments.length?("function"==typeof t&&(v=t),u=!!t,k):u},k.title=function(t){return arguments.length?(f=t,k):f},k.transitionDuration=function(t){return arguments.length?(l=t,k):l},k.transitionEase=function(t){return arguments.length?(c=t,k):c},k.sort=function(t){return arguments.length?(s=t,k):s},k.inverted=function(t){return arguments.length?(d=t,k):d},k.label=function(t){return arguments.length?(w=t,k):w},k.search=function(t){var n=[];return a.each(function(e){n=function(t,n){var e=new RegExp(n),r=[];return function t(n){var o=y(n);m(n)&&m(n).forEach(function(n){t(n)}),o.match(e)?(n.highlight=!0,r.push(n)):n.highlight=!1}(t),r}(e,t),A()}),n},k.clear=function(){a.each(function(t){!function t(n){n.highlight=!1,m(n)&&m(n).forEach(function(n){t(n)})}(t),A()})},k.zoomTo=function(t){C(t)},k.resetZoom=function(){a.each(function(t){C(t)})},k.onClick=function(t){return arguments.length?(h=t,k):h},k.merge=function(t){var e;a.each(function(r){!function t(n,e){e.forEach(function(e){var r=n.find(function(t){return t.name===e.name});r?(r.original?r.original+=e.value:r.value+=e.value,e.children&&(r.children||(r.children=[]),t(r.children,e.children))):n.push(e)})}([r.data],[t]),j(e=n.hierarchy(r.data,function(t){return m(t)}))}),a=a.datum(e),A()},k.color=function(t){return arguments.length?(M=t,k):M},k.minFrameSize=function(t){return arguments.length?(p=t,k):p},k.details=function(t){return arguments.length?(g=t,k):g},k},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3")):"function"==typeof define&&define.amd?define(["exports","d3"],n):n(t.d3=t.d3||{},t.d3)}(this,function(t,n){"use strict";var e="default"in n?n.default:n,r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var o,i=(function(t){!function(n,r){if(t.exports){var o=e;t.exports=r(o)}else n.d3.tip=r(n.d3)}(r,function(t){return function(){var n=function(){return"n"},e=function(){return[0,0]},r=function(){return" "},o=s(),i=null,a=null,u=null;function f(t){var n;i="svg"===(n=(n=t).node()).tagName.toLowerCase()?n:n.ownerSVGElement,a=i.createSVGPoint(),document.body.appendChild(o)}f.show=function(){var t=Array.prototype.slice.call(arguments);t[t.length-1]instanceof SVGElement&&(u=t.pop());var o,i=r.apply(this,t),a=e.apply(this,t),s=n.apply(this,t),h=d(),p=c.length,g=document.documentElement.scrollTop||document.body.scrollTop,v=document.documentElement.scrollLeft||document.body.scrollLeft;for(h.html(i).style("opacity",1).style("pointer-events","all");p--;)h.classed(c[p],!1);return o=l.get(s).apply(this),h.classed(s,!0).style("top",o.top+a[0]+g+"px").style("left",o.left+a[1]+v+"px"),f},f.hide=function(){return d().style("opacity",0).style("pointer-events","none"),f},f.attr=function(n,e){if(arguments.length<2&&"string"==typeof n)return d().attr(n);var r=Array.prototype.slice.call(arguments);return t.selection.prototype.attr.apply(d(),r),f},f.style=function(n,e){if(arguments.length<2&&"string"==typeof n)return d().style(n);var r=Array.prototype.slice.call(arguments);return t.selection.prototype.style.apply(d(),r),f},f.direction=function(t){return arguments.length?(n=null==t?t:p(t),f):n},f.offset=function(t){return arguments.length?(e=null==t?t:p(t),f):e},f.html=function(t){return arguments.length?(r=null==t?t:p(t),f):r},f.destroy=function(){return o&&(d().remove(),o=null),f};var l=t.map({n:function(){var t=h();return{top:t.n.y-o.offsetHeight,left:t.n.x-o.offsetWidth/2}},s:function(){var t=h();return{top:t.s.y,left:t.s.x-o.offsetWidth/2}},e:function(){var t=h();return{top:t.e.y-o.offsetHeight/2,left:t.e.x}},w:function(){var t=h();return{top:t.w.y-o.offsetHeight/2,left:t.w.x-o.offsetWidth}},nw:function(){var t=h();return{top:t.nw.y-o.offsetHeight,left:t.nw.x-o.offsetWidth}},ne:function(){var t=h();return{top:t.ne.y-o.offsetHeight,left:t.ne.x}},sw:function(){var t=h();return{top:t.sw.y,left:t.sw.x-o.offsetWidth}},se:function(){var t=h();return{top:t.se.y,left:t.e.x}}}),c=l.keys();function s(){var n=t.select(document.createElement("div"));return n.style("position","absolute").style("top",0).style("opacity",0).style("pointer-events","none").style("box-sizing","border-box"),n.node()}function d(){return null===o&&(o=s(),document.body.appendChild(o)),t.select(o)}function h(){for(var n=u||t.event.target;void 0===n.getScreenCTM&&"undefined"===n.parentNode;)n=n.parentNode;var e={},r=n.getScreenCTM(),o=n.getBBox(),i=o.width,f=o.height,l=o.x,c=o.y;return a.x=l,a.y=c,e.nw=a.matrixTransform(r),a.x+=i,e.ne=a.matrixTransform(r),a.y+=f,e.se=a.matrixTransform(r),a.x-=i,e.sw=a.matrixTransform(r),a.y-=f/2,e.w=a.matrixTransform(r),a.x+=i,e.e=a.matrixTransform(r),a.x-=i/2,a.y-=f/2,e.n=a.matrixTransform(r),a.y+=f,e.s=a.matrixTransform(r),e}function p(t){return"function"==typeof t?t:function(){return t}}return f}})}(o={exports:{}},o.exports),o.exports);t.flamegraph=function(){var t,e=960,r=null,o=18,a=null,u=!0,f="",l=750,c=n.easeCubic,s=!1,d=!1,h=null,p=0,g=null,v=i().direction("s").offset([8,0]).attr("class","d3-flame-graph-tip").html(function(t){return w(t)});function y(t){return t.data.n||t.data.name}function m(t){return t.c||t.children}function x(t){return t.v||t.value}var w=function(t){return y(t)+" ("+n.format(".3f")(100*(t.x1-t.x0),3)+"%, "+x(t)+" samples)"};function b(t){g&&(g.innerHTML=t)}var M=function(t){return t.highlight?"#E600E6":function(t,n){var e,r,o,i;void 0===n||""===n?i="warm":(i="red",void 0!==t&&t&&t.match(/::/)&&(i="yellow"),"kernel"===n?i="orange":"jit"===n?i="green":"inlined"===n&&(i="aqua"));var a=0;if(t){var u=t.split("`");u.length>1&&(t=u[u.length-1]),t=t.split("(")[0],a=function(t){var n=0,e=0,r=1;if(t){for(var o=0;o<t.length&&!(o>6);o++)n+=r*(t.charCodeAt(o)%10),e+=9*r,r*=.7;e>0&&(n/=e)}return n}(t)}return"red"===i?(e=200+Math.round(55*a),r=50+Math.round(80*a),o=r):"orange"===i?(e=190+Math.round(65*a),r=90+Math.round(65*a),o=0):"yellow"===i?(e=175+Math.round(55*a),r=e,o=50+Math.round(20*a)):"green"===i?(e=50+Math.round(60*a),r=200+Math.round(55*a),o=e):"aqua"===i?(e=50+Math.round(60*a),r=165+Math.round(55*a),o=r):(e=200+Math.round(55*a),r=0+Math.round(230*(1-a)),o=0+Math.round(55*(1-a))),"rgb("+e+","+r+","+o+")"}(y(t),function(t){return t.data.l||t.data.libtype}(t))};function E(t){t.data.hide=!0,m(t)&&m(t).forEach(E)}function T(t){t.data.fade=!1,t.data.hide=!1,m(t)&&m(t).forEach(T)}function C(t){v.hide(t),function t(n){(function(t){var n=[];if(t.parent){var e=t.parent.children.indexOf(t);(n=t.parent.children.slice(0)).splice(e,1)}return n})(n).forEach(function(t){E(t)}),n.parent&&t(n.parent)}(t),T(t),function t(n){n.parent&&(n.parent.data.fade=!0,t(n.parent))}(t),A(),"function"==typeof h&&h(t)}function H(t,e){return"function"==typeof s?s(t,e):s?n.ascending(y(t),y(e)):void 0}var S=n.partition();function A(){a.each(function(t){var i=n.scaleLinear().range([0,e]),a=n.scaleLinear().range([0,o]);s&&t.sort(H),t.sum(function(t){if(t.fade||t.hide)return 0;var n=x(t);if(m(t))for(var e=m(t),r=0;r<e.length;r++)n-=x(e[r]);return n}),S(t);var f=e/(t.x1-t.x0);function h(t){return(t.x1-t.x0)*f}var g=function(t){var n=t.descendants();if(p>0){var r=e/(t.x1-t.x0);n=n.filter(function(t){return(t.x1-t.x0)*r>p})}return n}(t),E=n.select(this).select("svg").selectAll("g").data(g,function(t){return t.id});E.transition().duration(l).ease(c).attr("transform",function(t){return"translate("+i(t.x0)+","+(d?a(t.depth):r-a(t.depth)-o)+")"}),E.select("rect").attr("width",h);var T=E.enter().append("svg:g").attr("transform",function(t){return"translate("+i(t.x0)+","+(d?a(t.depth):r-a(t.depth)-o)+")"});T.append("svg:rect").transition().delay(l/2).attr("width",h),u||T.append("svg:title"),T.append("foreignObject").append("xhtml:div"),(E=n.select(this).select("svg").selectAll("g").data(g,function(t){return t.id})).attr("width",h).attr("height",function(t){return o}).attr("name",function(t){return y(t)}).attr("class",function(t){return t.data.fade?"frame fade":"frame"}),E.select("rect").attr("height",function(t){return o}).attr("fill",function(t){return M(t)}),u||E.select("title").text(w),E.select("foreignObject").attr("width",h).attr("height",function(t){return o}).select("div").attr("class","d3-flame-graph-label").style("display",function(t){return h(t)<35?"none":"block"}).transition().delay(l).text(y),E.on("click",C),E.exit().remove(),E.on("mouseover",function(t){u&&v.show(t,this),b(w(t))}).on("mouseout",function(t){u&&v.hide(t),b("")})})}function L(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function j(t){t.id=L()+"-"+L()+"--"+L()+"-"+L();for(var n=t.c||t.children||[],e=0;e<n.length;e++)j(n[e])}function k(i){var u=n.hierarchy(i.datum(),function(t){return m(t)});if(j(u),a=i.datum(u),!arguments.length)return k;r||(r=(u.height+2)*o),a.each(function(o){t||(t=n.select(this).append("svg:svg").attr("width",e).attr("height",r).attr("class","partition d3-flame-graph").call(v)).append("svg:text").attr("class","title").attr("text-anchor","middle").attr("y","25").attr("x",e/2).attr("fill","#808080").text(f)}),A()}return k.height=function(t){return arguments.length?(r=t,k):r},k.width=function(t){return arguments.length?(e=t,k):e},k.cellHeight=function(t){return arguments.length?(o=t,k):o},k.tooltip=function(t){return arguments.length?("function"==typeof t&&(v=t),u=!!t,k):u},k.title=function(t){return arguments.length?(f=t,k):f},k.transitionDuration=function(t){return arguments.length?(l=t,k):l},k.transitionEase=function(t){return arguments.length?(c=t,k):c},k.sort=function(t){return arguments.length?(s=t,k):s},k.inverted=function(t){return arguments.length?(d=t,k):d},k.label=function(t){return arguments.length?(w=t,k):w},k.search=function(t){var n=[];return a.each(function(e){n=function(t,n){var e=new RegExp(n),r=[];return function t(n){var o=y(n);m(n)&&m(n).forEach(function(n){t(n)}),void 0!==o&&o&&o.match(e)?(n.highlight=!0,r.push(n)):n.highlight=!1}(t),r}(e,t),A()}),n},k.clear=function(){a.each(function(t){!function t(n){n.highlight=!1,m(n)&&m(n).forEach(function(n){t(n)})}(t),A()})},k.zoomTo=function(t){C(t)},k.resetZoom=function(){a.each(function(t){C(t)})},k.onClick=function(t){return arguments.length?(h=t,k):h},k.merge=function(t){var e;a.each(function(r){!function t(n,e){e.forEach(function(e){var r=n.find(function(t){return t.name===e.name});r?(r.original?r.original+=e.value:r.value+=e.value,e.children&&(r.children||(r.children=[]),t(r.children,e.children))):n.push(e)})}([r.data],[t]),j(e=n.hierarchy(r.data,function(t){return m(t)}))}),a=a.datum(e),A()},k.color=function(t){return arguments.length?(M=t,k):M},k.minFrameSize=function(t){return arguments.length?(p=t,k):p},k.details=function(t){return arguments.length?(g=t,k):g},k},Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-flame-graph", | ||
"version": "2.0.0-alpha4", | ||
"version": "2.0.0-alpha5", | ||
"description": "A d3.js library to produce flame graphs.", | ||
@@ -5,0 +5,0 @@ "main": "dist/d3-flamegraph.js", |
@@ -94,3 +94,3 @@ import { select, format, ascending, partition, hierarchy, scaleLinear, easeCubic } from 'd3' | ||
hue = 'red' | ||
if (name.match(/::/)) { | ||
if (typeof name !== 'undefined' && name && name.match(/::/)) { | ||
hue = 'yellow' | ||
@@ -222,3 +222,3 @@ } | ||
if (label.match(re)) { | ||
if (typeof label !== 'undefined' && label && label.match(re)) { | ||
d.highlight = true | ||
@@ -225,0 +225,0 @@ searchResults.push(d) |
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
11189315