Skip to content
Permalink
Browse files

fix bug to not duplicate breadcrumb trail

  • Loading branch information
timelyportfolio committed Feb 27, 2018
1 parent 00b9737 commit fcb11b002456f2e522b0644d7df09a19332f7c96
Showing with 23 additions and 9 deletions.
  1. +11 −4 inst/htmlwidgets/sunburst.js
  2. +12 −5 javascript/src/sunburst-chart.js
@@ -307,12 +307,19 @@ function draw (el, instance, dispatch_) {

function initializeBreadcrumbTrail() {
// Add the svg area.
var trail = d3Selection.select(el).select(".sunburst-sequence").append("svg")
.attr("width", width)
//.attr("height", 50)
var trail = d3Selection.select(el).select(".sunburst-sequence").select("svg");
if(trail.nodes().length === 0) {
trail = d3Selection.select(el).select(".sunburst-sequence").append("svg")
.attr("id", el.id + "-trail");
trail.append("text");
}

trail
.attr("width", width);
//.attr("height", 50)

// Add the label at the end, for the percentage.
trail.append("text")
trail.select("text")
.attr("id", el.id + "-endlabel")
.style("fill", "#000");
}
@@ -304,12 +304,19 @@ export default function (el, instance, dispatch_) {

function initializeBreadcrumbTrail() {
// Add the svg area.
var trail = select(el).select(".sunburst-sequence").append("svg")
.attr("width", width)
//.attr("height", 50)
.attr("id", el.id + "-trail");
var trail = select(el).select(".sunburst-sequence").select("svg")
if(trail.nodes().length === 0) {
trail = select(el).select(".sunburst-sequence").append("svg")
.attr("id", el.id + "-trail")
trail.append("text")
}

trail
.attr("width", width);
//.attr("height", 50)

// Add the label at the end, for the percentage.
trail.append("text")
trail.select("text")
.attr("id", el.id + "-endlabel")
.style("fill", "#000");
}

0 comments on commit fcb11b0

Please sign in to comment.
You can’t perform that action at this time.