Skip to content

Commit

Permalink
Fixing bugs in Sankey diagrams
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 committed Feb 27, 2017
1 parent 9dd7778 commit ab9d947
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions superset/assets/visualizations/sankey.js
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 ab9d947

Please sign in to comment.