function bar(d) {
        var bar = svg.insert("g", ".y.axis")
            .attr("class", "enter")
            .attr("transform", "translate(0,5)")
            .selectAll("g")
            .data(d.children)
            .enter().append("g")
            .style("cursor", function(d) { return !d.children ? null : "pointer"; })
            .on("click", down);
        bar.append("text")
            .attr("x", -6)
            .attr("y", barHeight / 2)
            .attr("dy", ".35em")
            .style("text-anchor", "end")
            .text(function(d) { return d.data.name; });
        bar.append("rect")
            .attr("width", function(d) { 
                return x(d.data.value); 
            })
            .attr("height", barHeight)
            .on("mousemove", function(d){
                var info = (d.data.name)
                if(level == 1 || level == 2){
                    info = info  + ": <br>" + (d.data.CompanyCount) + " Companies"
                }
                else
                {
                    info = "Company:" + info  + "<br> Global Ranking: " +(d.data.Rank) + "<br> Revenue: " +(d.data.Revenue) 
                }
                tooltip
                  .style("left", d3.event.pageX + 20 + "px")
                  .style("top", d3.event.pageY - 20 + "px")
                  .style("display", "inline-block")
                  .html(info);
              })
            .on("mouseout", function(d){ tooltip.style("display", "none");});;
        return bar;
    }
// Creates a set of bars for the given data node, at the specified index.
Creates a set of bars for the given data node, at the specified index.
Creates a set of bars for the given data node at the specified index .
function bar(d) {
        var bar = svg.insert("g", ".y.axis")
            .attr("class", "enter")
            .attr("transform", "translate(0,5)")
            .selectAll("g")
            .data(d.children)
            .enter().append("g")
            .style("cursor", function(d) { return !d.children ? null : "pointer"; })
            .on("click", down);
        bar.append("text")
            .attr("x", -6)
            .attr("y", barHeight / 2)
            .attr("dy", ".35em")
            .style("text-anchor", "end")
            .text(function(d) { return d.data.name; });
        bar.append("rect")
            .attr("width", function(d) { 
                return x(d.data.value); 
            })
            .attr("height", barHeight)
            .on("mousemove", function(d){
                var info = (d.data.name)
                if(level == 1 || level == 2){
                    info = info  + ": <br>" + (d.data.CompanyCount) + " Companies"
                }
                else
                {
                    info = "Company:" + info  + "<br> Global Ranking: " +(d.data.Rank) + "<br> Revenue: " +(d.data.Revenue) 
                }
                tooltip
                  .style("left", d3.event.pageX + 20 + "px")
                  .style("top", d3.event.pageY - 20 + "px")
                  .style("display", "inline-block")
                  .html(info);
              })
            .on("mouseout", function(d){ tooltip.style("display", "none");});;
        return bar;
    }
function bar ( d ) { var bar = svg . insert ( "g" , ".y.axis" ) . attr ( "class" , "enter" ) . attr ( "transform" , "translate(0,5)" ) . selectAll ( "g" ) . data ( d . children ) . enter ( ) . append ( "g" ) . style ( "cursor" , function ( d ) { return ! d . children ? null : "pointer" ; } ) . on ( "click" , down ) ; bar . append ( "text" ) . attr ( "x" , - 6 ) . attr ( "y" , barHeight / 2 ) . attr ( "dy" , ".35em" ) . style ( "text-anchor" , "end" ) . text ( function ( d ) { return d . data . name ; } ) ; bar . append ( "rect" ) . attr ( "width" , function ( d ) { return x ( d . data . value ) ; } ) . attr ( "height" , barHeight ) . on ( "mousemove" , function ( d ) { var info = ( d . data . name ) if ( level == 1 || level == 2 ) { info = info + ": <br>" + ( d . data . CompanyCount ) + " Companies" } else { info = "Company:" + info + "<br> Global Ranking: " + ( d . data . Rank ) + "<br> Revenue: " + ( d . data . Revenue ) } tooltip . style ( "left" , d3 . event . pageX + 20 + "px" ) . style ( "top" , d3 . event . pageY - 20 + "px" ) . style ( "display" , "inline-block" ) . html ( info ) ; } ) . on ( "mouseout" , function ( d ) { tooltip . style ( "display" , "none" ) ; } ) ; ; return bar ; }
Creates a set of bars for the given data node, at the specified index.
Creates a set of bars for the given data node at the specified index .