merged pfeffer's pull request, also updated indented tree zerofilter

master-patched
Tyler Wolf 11 years ago
parent 2572a1ed21
commit 536e4fe531

@ -98,7 +98,9 @@ nv.addGraph(function() {
.color(d3.scale.category10().range())
.width(width)
.height(height)
.donut(true);
.donut(false);
chart.pie.donutLabelsOutside(true).donut(true);
d3.select("#test2")
//.datum(historicalBarChart)

@ -128,9 +128,11 @@ nv.models.indentedTree = function() {
.attr('class', 'nv-childrenCount');
node.selectAll('span.nv-childrenCount').text(function(d) {
return ((d.values && d.values.length) || (d._values && d._values.length)) ?
'(' + ((d.values && d.values.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; }).length) || (d._values && d._values.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; }).length)) + ')'
: ''
return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent
'(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter
|| (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values...
|| 0) + ')' //This is the catch-all in case there are no children after a filter
: '' //If this is not a parent, just give an empty string
});
}

@ -140,16 +140,11 @@ nv.models.pie = function() {
if (showLabels) {
// This does the normal label
var labelsArc
if (pieLabelsOutside){
labelsArc = arc;
}else{
labelsArc = d3.svg.arc().innerRadius(0);
}
//var labelsArc = arc;
if (donutLabelsOutside) {
labelsArc = d3.svg.arc().outerRadius(arc.outerRadius());
}
var labelsArc = d3.svg.arc().innerRadius(0);
if (pieLabelsOutside){ labelsArc = arc; }
if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); }
ae.append("g").classed("nv-label", true)
.each(function(d, i) {

Loading…
Cancel
Save