From b9550a02668a1583223d4b9042e2ef4006e2d906 Mon Sep 17 00:00:00 2001 From: Dan Doyle Date: Thu, 14 Nov 2019 19:59:15 +0000 Subject: [PATCH] adding bail out for empty sankey graph --- src/netsage_sankey.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/netsage_sankey.js b/src/netsage_sankey.js index 8f2f803..ac7ed06 100644 --- a/src/netsage_sankey.js +++ b/src/netsage_sankey.js @@ -422,7 +422,7 @@ export class NetSageSankey extends MetricsPanelCtrl { // get sankey graph from data var graph = ctrl.createSankeyGraphFromData(sankeyData); - + //render sankey ctrl.renderSankey(graph); } @@ -477,6 +477,11 @@ export class NetSageSankey extends MetricsPanelCtrl { // make sankey chart renderSankey(graph) { + + if (graph.links.length == 0 || graph.nodes.length == 0){ + return; + } + var ctrl = this; d3.select('#' + ctrl.containerDivId).selectAll('g').remove();