From d079164aaa9e9800792161bb2008ce33cd111ebc Mon Sep 17 00:00:00 2001 From: ConorDavenport Date: Fri, 15 May 2020 11:48:12 +0100 Subject: [PATCH 1/2] add select member function to chart --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index a5c5586..bc0ffe4 100644 --- a/index.js +++ b/index.js @@ -971,6 +971,10 @@ function flameGraph (opts) { return getNodeRect(node) } + chart.select = function (node, color) { + node.highlight = true + } + chart.on = dispatch.on.bind(dispatch) exclude.forEach(chart.typeHide) From ddf88a18a0595317dcd1a81f30bf6459b6d9a927 Mon Sep 17 00:00:00 2001 From: ConorDavenport Date: Fri, 15 May 2020 13:19:31 +0100 Subject: [PATCH 2/2] add deselect function --- index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index bc0ffe4..be37e17 100644 --- a/index.js +++ b/index.js @@ -972,7 +972,13 @@ function flameGraph (opts) { } chart.select = function (node, color) { - node.highlight = true + node.highlight = color || true + update() + } + + chart.deselect = function (node) { + node.highlight = false + update() } chart.on = dispatch.on.bind(dispatch)