hive/html/d3js/sunburst_hierarchy.js
// Update the breadcrumb trail to show the current sequence and percentage.
Update the breadcrumb trail to show the current sequence and percentage.
Update the breadcrumb trail to show the current sequence and percentage .
function updateBreadcrumbs(nodeArray, percentageString) {
                var Nout=5; 
                var printable=nodeArray.length-Nout+1;
                var space = 1;
                if (printable < 2){
                    space = 0;
                }
                if(printable<1){
                    printable=1;
                }
          var g = 
              trail.selectAll("g")
              .data(nodeArray, function(d) { return d.shortname + d.depth; });
          var entering = g.enter().append("svg:g");
          entering.append("svg:polygon")
              .attr("points", breadcrumbPoints)
              .style("fill", function(d,i) {return clr(d);});
          entering.append("svg:text")
              .attr("x", (b.w + b.t) / 2)
              .attr("y", b.h / 2)
              .attr("dy", "0.35em")
              .attr("text-anchor", "middle")
              .text(function(d) { return d.shortname; })
              .style("font-size","10px");;
          g.attr("transform", function(d, i) {
                  if(d.lev_depth==1)
                          return "translate(0, 0)";
                  else if(d.lev_depth>printable)
                                return "translate(" + ((d.lev_depth-printable) * (b.w + b.s)+ (space)*b.w/2) + ", 0)";
                  else return "translate(-200, 0)";
          });
          g.exit().remove();
          if (Nout > nodeArray.length){
              Nout = nodeArray.length;
          }
          trail.select("#endlabel")
              .attr("x", (Nout+0.5) * (b.w + b.s) + (space)*b.w/2)
              .attr("y", b.h / 2)
              .attr("dy", "0.35em")
              .attr("text-anchor", "middle")
              .text(percentageString);
                trail.style("visibility", function (d,i){
                          return "";
                });
        }
function updateBreadcrumbs ( nodeArray , percentageString ) { var Nout = 5 ; var printable = nodeArray . length - Nout + 1 ; var space = 1 ; if ( printable < 2 ) { space = 0 ; } if ( printable < 1 ) { printable = 1 ; } var g = trail . selectAll ( "g" ) . data ( nodeArray , function ( d ) { return d . shortname + d . depth ; } ) ; var entering = g . enter ( ) . append ( "svg:g" ) ; entering . append ( "svg:polygon" ) . attr ( "points" , breadcrumbPoints ) . style ( "fill" , function ( d , i ) { return clr ( d ) ; } ) ; entering . append ( "svg:text" ) . attr ( "x" , ( b . w + b . t ) / 2 ) . attr ( "y" , b . h / 2 ) . attr ( "dy" , "0.35em" ) . attr ( "text-anchor" , "middle" ) . text ( function ( d ) { return d . shortname ; } ) . style ( "font-size" , "10px" ) ; ; g . attr ( "transform" , function ( d , i ) { if ( d . lev_depth == 1 ) return "translate(0, 0)" ; else if ( d . lev_depth > printable ) return "translate(" + ( ( d . lev_depth - printable ) * ( b . w + b . s ) + ( space ) * b . w / 2 ) + ", 0)" ; else return "translate(-200, 0)" ; } ) ; g . exit ( ) . remove ( ) ; if ( Nout > nodeArray . length ) { Nout = nodeArray . length ; } trail . select ( "#endlabel" ) . attr ( "x" , ( Nout + 0.5 ) * ( b . w + b . s ) + ( space ) * b . w / 2 ) . attr ( "y" , b . h / 2 ) . attr ( "dy" , "0.35em" ) . attr ( "text-anchor" , "middle" ) . text ( percentageString ) ; trail . style ( "visibility" , function ( d , i ) { return "" ; } ) ; }
Update the breadcrumb trail to show the current sequence and percentage.
Update the breadcrumb trail to show the current sequence and percentage .
// By default there is 1 // Data join; key function combines name and depth (= position in sequence). // thiSS.d3area.append("svg") // d3.select("#trail") //.attr("id","#trail") // Add breadcrumb and label for entering nodes. //{ return colors[d.name]; }); // Set position for entering and updating nodes. // Remove exiting nodes. // Now move and update the percentage at the end. // Make the breadcrumb trail visible, if it's hidden. //if(d.lev_depth>0 && d.lev_depth<printable) //        return "hidden"; //else 