Skip to content

Commit

Permalink
Fixing bugs in Sankey diagrams (#2290)
Browse files Browse the repository at this point in the history
* NULL values for name breaks the chart
* negative rect svg height values
  • Loading branch information
mistercrunch authored Feb 28, 2017
1 parent 9dd7778 commit 47be3ef
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions superset/assets/visualizations/sankey.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 47be3ef

Please sign in to comment.