{"name":"d3-fg","version":"6.13.0","description":"Flamegraph visualization for d3 v3.5.x","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"David Mark Clements","email":"david.clements@nearform.com"},"license":"Apache-2.0","dependencies":{"d3-array":"^1.2.1","d3-ease":"^1.0.3","d3-hierarchy":"^1.1.6","d3-scale":"^2.1.0","d3-selection":"^1.3.0","d3-zoom":"^1.7.1","escape-string-regexp":"^1.0.5","hsl-to-rgb-for-reals":"^1.1.0"},"devDependencies":{},"repository":{"type":"git","url":"git+https://github.com/davidmarkclements/d3-fg.git"},"keywords":[],"bugs":{"url":"https://github.com/davidmarkclements/d3-fg/issues"},"homepage":"https://github.com/davidmarkclements/d3-fg#readme","gitHead":"79876d742f9d1f7c51e1fd301e142aa6f7f0355a","_id":"d3-fg@6.13.0","_nodeVersion":"10.14.2","_npmVersion":"6.6.0-next.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"integrity":"sha512-8xjc6QRt1ISVD2DXNa5p+6z6tEJYJlmqJ8JuSYFyWF3oCWb3+t1vO8za7yZaCfrnaKtPzncJX95Qew/U/U28fw==","shasum":"e53c2d73559d9412706d98b4d3ae664be446429b","tarball":"http://registry-npm.ywwl.com/d3-fg/download/d3-fg-6.13.0.tgz","fileCount":4,"unpackedSize":51169,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcMxYPCRA9TVsSAnZWagAA5ksQAJPdbAAqIcYRLe1618Dg\n+F44wR84W5vEaoMuLfPutT2pZUDS/Ll0i/79CYnltqBvX7I+6+N6vfD6B7+P\nzi/vwasR31Iiip0vuV/meFoe1nN0v1tKidHWx2re5YKayDf0kOt647RIYWwe\nyXtOUQp9UZjbUkvB5x+gqkGpuUwa7LBaJor6G8yRMZTtHpw5BIldL7V9uQzD\nXFXvPwe7fiFNtEELyvbrmodsceInsVkvXVegWhCkSKQdt82rRzdK+j0WLX9F\nyR81AjPOJfIfb0d3TG0imBxQv/BEEc5wY2SmjflBr61wXFG5sJk+WfnoEchV\nwlNBfS16NE49gxEnvw9W60HzvAKsIC00DNyFrafT/qMsvO8EKXMenBa+L7fk\nftkHtdsfU2w07oR78NL5TnrtnhdXl/VKRee3WttF8o54IOsSvM3Ukn+h7dWt\nSlbTVkropBDiNxAIBLwNForGnNWFQfpdqzROMvu9wC69USaEb45w30LB2vNe\n1LQaslhFkGQj+K53yqCFdgDd3pWoe00nXE+A1k4p0H9/ctfp9VriSp7zhWoX\nwuX8f5JAry8VVy9zzIGOOCS7PxrivgaD4lAf/t6wyknFH+qaM8395Zh86jpi\n2x9K96g7vkTLUBAs2piug3M/1TIl3R0qL/snHqbWnxoRxRNJltPG7hHZ4T8e\ngr+9\r\n=zz8k\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4Czoh9g8AyhLFWeBfWE7DV59m6JW760CglEzS4AgNKQIgFUzo88GXvZGj8gM4DJfpifOo4DHP3uFpZe5Gw1ZtwlE="}],"size":15673,"noattachment":false,"key":"/d3-fg/-/d3-fg-6.13.0.tgz"},"maintainers":[{"name":"davidmarkclements","email":"huperekchuno@googlemail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/d3-fg_6.13.0_1546851855194_0.49853124417121664"},"_hasShrinkwrap":false,"readme":"# d3-fg\n\nFlamegraph visualization for d3 v5.x\n\n## Installation\n\n```sh\nnpm install d3-fg --save\n```\n\n## Usage\n\nd3-fg is currently built against [d3](http://npm.im/d3) v5.x.\n\n```js\nvar tree = require('./data.json') // d3 json tree\nvar element = document.querySelector('chart') // <chart> element which should be in html body\nvar flamegraph = require('d3-flamegraph')({tree, element})\n```\n\n## Dispatch listeners\n\nUsing `d3.dispatch`, d3-fg defines events that can be listened for and responded to in the calling application.\n\n- `click` On clicks on the flamegraph. If the click is not on a frame, all args are passed as `null` to allow for 'deselection'-like responses:\n\n ```js\n flamegraph.on('click', (nodeData, rect, pointerCoords) => {\n   nodeData         // Null or Object, this datum from the original data set (from node.data)\n   rect,            // Null or Object, the co-ordinates of this frame's rendered rectangle\n   pointerCoords    // Null or Object, the `x` and `y` co-ordinates of the click event\n }\n ```\n\n - `hoverin` On hovering in to a rendered frame on the flamegraph. Same args as `click`\n - `hoverout` On hovering out of a rendered frame on the flamegraph. No args passed.\n - `dblClick` On double clicking on a rendered frame on the flamegraph. Same args as `click`.\n - `contextmenu` On right clicking on a rendered frame on the flamegraph. Same args as `click`.\n - `zoom` On d3-fg executing a zoom on a frame.\n\n ```js\n flamegraph.on('zoom', (nodeData) => {\n   nodeData         // Null or Object, this datum from the original data set (from node.data)\n }\n ```\n\n - `animationEnd` On d3-fg completing animations. No args.\n\n## Options\n\nPass in options as an object, including optional overrides for the following built-in actions:\n\n - `colorHash` - Applying calculated colours using a built-in orange-to-red scale based on time spent at stack top\n - `renderTooltip` - Creating and updating a tooltip giving basic frame information\n - `renderLabel` - Writing frame information on the frames themselves in Canvas\n - `renderStackFrameBox` - Drawing the frame rectangles in Canvas, including redrawing on hover\n - `clickHandler` - Zooming in on nodes when clicked on, or zooming out when clicking outside any node\n - `isNodeExcluded` - Checking if a frame should be hidden based on its node data and the current exclusion filters\n\n```js\nrequire('d3-flamegraph')({\n  // Required:\n  tree: {     // tree object like d3.hierarchy() https://github.com/d3/d3-hierarchy/#hierarchy - expects:\n    parent,   // Object reference with same schema, falsy for root node (options.tree itself)\n    children, // Array of objects with same schema, falsy for leaf nodes (nodes without children)\n    depth     // Number of ancestors in tree (position in stack from bottom), zero for root node\n  },\n  element,    // Existing DOM reference. Do not pass a d3 selection, use d3.select(...).node()\n\n  // Optional:\n  exclude,    // Iterable or Array, containing type strings used to filter and hide frames\n  timing,     // Boolean, if passed as true logs times to console\n  categorizer: function (data, index, children) { // Function that determines the category for a given\n                                                  // stack frame. e.g. \"app\", \"core\"\n    return {\n      type // String, indicates the category\n    }\n  }\n  height,     // Number (pixels). If not set, is calculated based on tallest stack\n  width,      // Number (pixels). If not set, is calculated based on clientWidth when called\n  cellHeight, // Number (pixels). Defaults to 18 pixels. Font sizes scale along with this value.\n  collapseHiddenNodeWidths, // Boolean, see below\n  heatBars, // Boolean, when false (default), heat is visualized as the background colour of stack frames;\n            // when true, heat is visualized by a bar drawn on _top_ of stack frames\n  frameColors: { // Object, colors for the stack frame boxes.\n                 // Used when `heatBars: true`, and for the \"all stacks\" row when `heatBars: false`\n    fill,   // String, background color.\n    stroke, // String, border color.\n  },\n  labelColors: { // Object, colors for the text labels on stack frames\n    default,        // String, the default color (required).\n    [categoryName], // Optionally, colors for different categories such as \"app\", \"cpp\".\n                    // If one of these is not set for a category, labelColors.default is used\n  },\n\n\n  // Optional overridable functions. Pass a function; or null to disable. If undefined, default is used.\n  colorHash: function (stackTop, options) { // Sets each frame's RGB value. Default used if unset\n    const {\n      d,             // Object, d3 datum: one frame, one item in the tree\n      decimalAdjust, // Number, optional multiplier adjusting color intensity up or down e.g. for borders\n      allSamples,    // Number, total summed time value (i.e. time represented by flamegraph width)\n      tiers          // Boolean, true if base color varies by frame type e.g. app vs core\n    } = options\n    stackTop(d)      // Returns number representing time in this frame not in any non-hidden child frames\n    return           // String, expects valid rgb, rgba or hash string\n  },\n  renderTooltip: function (node) { // Renders tooltips created within d3-fg\n    node             // Object, a d3-fg node representing the highlighted frame\n    // no return value expected\n  },\n  renderLabel: function (frameHeight, options) { // Writing on-frame Canvas labels\n    const {\n      context,       // Object, the Canvas DOM object being modified\n      node,          // Object, a d3-fg node representing the frame being labelled\n      x,             // Number, the x co-ordinate of the top left corner of the frame\n      y,             // Number, the y co-ordinate of the top left corner of the frame\n      width          // Number, the pixel width of the frame\n    } = options\n    frameHeight      // Number, the default pixel height for all frames in the flamegraph\n  },\n  renderStackFrameBox: function (globals, locals, rect) {\n    const {\n      STATE_HOVER,   // Number, for comparison against `state` to see if this frame is hoverred\n      STATE_UNHOVER, // Number, as above but for frames that are no longer hoverred\n      STATE_IDLE,    // Number, as above but for frames in normal, resting state\n      frameColors,   // Object, expects color definition strings keyed `fill` and `stroke`\n      colorHash      // Function, see above. Either default, override, or return frameColors.fill.\n    } = globals\n    const {\n      context,       // Object, the Canvas DOM object being modified\n      node,          // Object, a d3-fg node representing the frame being labelled\n      state          // Number, see STATE_HOVER, STATE_UNHOVER and STATE_IDLE above\n    } = locals\n    rect             // Object, numeric { x, y, width, height } values for this frame's rectangle\n  },\n  clickHandler: function (target) { // Responds to clicks on the canvas, before calling dispatch\n    target           // Null or Object, a d3-fg node representing the frame clicked on\n    this             // The DOM object (in this case, the Canvas)\n    return           // Returns target or all-stacks frame\n  },\n  isNodeExcluded: function (node, filterTypes) { // Used in filtering to set nodes' .hide property\n    node             // Object, a d3-fg node representing the frame being filtered\n    filterTypes      // Array, based on `exclude` if it is passed as an option\n  }\n})\n```\n\n### `collapseHiddenNodeWidths`\n\nBoolean, affects the widths of stack frames excluded by type filters.\n\nWhen true, hidden frames do not take up space, but instead all their visible children are aligned closely next to each other, to the left of their closest visible parent. In practice, this means that there are no gaps between frames. When toggling filters, frames may jump horizontally.\n\n## Dependencies\n\n- [hsl-to-rgb-for-reals](https://github.com/davidmarkclements/hsl_rgb_converter): simple HSL to RGB converter\n\n## Dev Dependencies\n\nNone\n\n## Acknowledgements\n\nSponsored by [nearForm](http://nearform.com).\n\nBased on the work by [Martin Spier](<http://martinspier.io/>) at <https://www.npmjs.com/package/stackvis>.\n\n## License\n\nApache 2.0\n","publish_time":1546851855348,"_cnpm_publish_time":1546851855348,"dist-tags":{"latest":"6.14.0"}}