Skip to content

Commit

Permalink
rename 'extra' -> 'remainder' + attrs description fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Mar 28, 2019
1 parent 5d981c2 commit 1258f2d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
10 changes: 4 additions & 6 deletions src/traces/sunburst/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ var pieAtts = require('../pie/attributes');

var extendFlat = require('../../lib/extend').extendFlat;

// TODO should we use singular `label`, `parent` and `value`?

module.exports = {
labels: {
valType: 'data_array',
Expand All @@ -34,7 +32,7 @@ module.exports = {
'the root node in the hierarchy.',
'If `ids` is filled, `parents` items are understood to be "ids" themselves.',
'When `ids` is not set, plotly attempts to find matching items in `labels`,',
'but beware there must be unique.'
'but beware they must be unique.'
].join(' ')
},

Expand All @@ -48,14 +46,14 @@ module.exports = {
},
branchvalues: {
valType: 'enumerated',
values: ['total', 'extra'],
dflt: 'extra',
values: ['remainder', 'total'],
dflt: 'remainder',
editType: 'calc',
role: 'info',
description: [
'Determines how the items in `values` are summed.',
'When set to *total*, items in `values` are taken to be value of all its descendants.',
'When set to *extra*, items in `values` corresponding to the root and the branches sectors',
'When set to *remainder*, items in `values` corresponding to the root and the branches sectors',
'are taken to be the extra part not part of the sum of the values at their leaves.'
].join(' ')
},
Expand Down
2 changes: 1 addition & 1 deletion src/traces/sunburst/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ exports.calc = function(gd, trace) {

if(hasVals) {
switch(trace.branchvalues) {
case 'extra':
case 'remainder':
hierarchy.sum(function(d) { return d.data.v; });
break;
case 'total':
Expand Down
Binary file modified test/image/baselines/sunburst_values.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions test/image/mocks/sunburst_values.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"data": [
{
"type": "sunburst",
"name": "with branchvalues:extra",
"name": "with branchvalues:remainder",
"labels": ["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
"parents": ["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
"values": [10, 14, 12, 10, 2, 6, 6, 1, 4],
Expand All @@ -27,7 +27,7 @@
"layout": {
"annotations": [{
"showarrow": false,
"text": "branchvalues: <b>extra</b>",
"text": "branchvalues: <b>remainder</b>",
"x": 0.25,
"xanchor": "center",
"y": 1.1,
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/tests/sunburst_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Test sunburst defaults:', function() {
{labels: [1], parents: ['']},
]);

expect(fullData[0].branchvalues).toBe('extra', 'base');
expect(fullData[0].branchvalues).toBe('remainder', 'base');
expect(fullData[1].branchvalues).toBe(undefined, 'no values');
});

Expand Down

0 comments on commit 1258f2d

Please sign in to comment.