Merge pull request #4030 from lukasolson/issues/3966

Use absolute values to compute pie chart slice size
This commit is contained in:
Rashid Khan 2015-06-03 08:32:40 -07:00
commit c277eb4c19
2 changed files with 3 additions and 7 deletions

View file

@ -23,11 +23,7 @@ define(function (require) {
row.spacer = $sce.trustAsHtml(_.repeat(' ', row.depth));
var percent;
if (i > 0) {
var parentMetric = rows[i - 1].metric;
percent = row.metric / parentMetric;
}
else if (row.item.percentOfGroup != null) {
if (row.item.percentOfGroup != null) {
percent = row.item.percentOfGroup;
}

View file

@ -69,11 +69,11 @@ define(function (require) {
var parentPercent = parent.percentOfParent;
var sum = parent.sumOfChildren = Math.abs(children.reduce(function (sum, child) {
return sum + child.size;
return sum + Math.abs(child.size);
}, 0));
children.forEach(function (child) {
child.percentOfGroup = child.size / sum;
child.percentOfGroup = Math.abs(child.size) / sum;
child.percentOfParent = child.percentOfGroup;
if (parentPercent != null) {