Fixing bugs in Sankey diagrams (#2290)

* NULL values for name breaks the chart
* negative rect svg height values
This commit is contained in:
Maxime Beauchemin 2017-02-27 17:07:10 -08:00 committed by GitHub
parent 9dd7778597
commit 47be3ef3ea

View File

@ -132,14 +132,13 @@ function sankeyVis(slice, payload) {
})
.on('drag', dragmove)
);
const minRectHeight = 5;
node.append('rect')
.attr('height', function (d) {
return d.dy;
})
.attr('height', d => d.dy > minRectHeight ? d.dy : minRectHeight)
.attr('width', sankey.nodeWidth())
.style('fill', function (d) {
d.color = category21(d.name.replace(/ .*/, ''));
const name = d.name || 'N/A';
d.color = category21(name.replace(/ .*/, ''));
return d.color;
})
.style('stroke', function (d) {