d3-flame-graph
Advanced tools
Comparing version 2.0.8 to 2.1.0
{ | ||
"name": "d3-flame-graph", | ||
"version": "2.0.8", | ||
"version": "2.1.0", | ||
"description": "A d3.js library to produce flame graphs.", | ||
@@ -5,0 +5,0 @@ "main": "dist/d3-flamegraph.js", |
@@ -279,8 +279,8 @@ # d3-flame-graph | ||
Replaces the built-in node color hash function. Function takes a single argument, the node data structure, and returns a color string. Example: | ||
Replaces the built-in node color hash function. Function takes two arguments, the node data structure and the original color string for that node. It must return a color string. Example: | ||
```js | ||
// Purple if highlighted, otherwise a static blue. | ||
flamegraph.setColorMapper(function(d) { | ||
return d.highlight ? "#E600E6" : "#0A5BC4"; | ||
// Purple if highlighted, otherwise the original color | ||
flamegraph.setColorMapper(function(d, originalColor) { | ||
return d.highlight ? "#E600E6" : originalColor; | ||
}); | ||
@@ -287,0 +287,0 @@ ``` |
@@ -739,3 +739,6 @@ import { select } from 'd3-selection' | ||
} | ||
colorMapper = _ | ||
colorMapper = (d) => { | ||
const originalColor = originalColorMapper(d) | ||
return _(d, originalColor) | ||
} | ||
return chart | ||
@@ -742,0 +745,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
12295709
9392