Merge pull request #4030 from lukasolson/issues/3966
Use absolute values to compute pie chart slice size
This commit is contained in:
commit
c277eb4c19
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue