Skip to content

Commit 9aaa10b

Browse files
committed
categoryorder: rename 'value' to 'total'
1 parent 54b3ff9 commit 9aaa10b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/plots/cartesian/layout_attributes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ module.exports = {
818818
valType: 'enumerated',
819819
values: [
820820
'trace', 'category ascending', 'category descending', 'array',
821-
'value ascending', 'value descending',
821+
'total ascending', 'total descending',
822822
'min ascending', 'min descending',
823823
'max ascending', 'max descending',
824824
'sum ascending', 'sum descending',
@@ -836,9 +836,9 @@ module.exports = {
836836
'Set `categoryorder` to *array* to derive the ordering from the attribute `categoryarray`. If a category',
837837
'is not found in the `categoryarray` array, the sorting behavior for that attribute will be identical to',
838838
'the *trace* mode. The unspecified categories will follow the categories in `categoryarray`.',
839-
'Set `categoryorder` to *value ascending* or *value descending* if order should be determined by the',
839+
'Set `categoryorder` to *total ascending* or *total descending* if order should be determined by the',
840840
'numerical order of the values.',
841-
'Similarly, the order can be determined by the min, max, sum, mean or media of all the values.'
841+
'Similarly, the order can be determined by the min, max, sum, mean or median of all the values.'
842842
].join(' ')
843843
},
844844
categoryarray: {

src/plots/plots.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,7 +2856,7 @@ plots.doCalcdata = function(gd, traces) {
28562856
Registry.getComponentMethod('errorbars', 'calc')(gd);
28572857
};
28582858

2859-
var sortAxisCategoriesByValueRegex = /(value|sum|min|max|mean|median) (ascending|descending)/;
2859+
var sortAxisCategoriesByValueRegex = /(total|sum|min|max|mean|median) (ascending|descending)/;
28602860

28612861
function sortAxisCategoriesByValue(axList, gd) {
28622862
var affectedTraces = [];
@@ -2889,7 +2889,7 @@ function sortAxisCategoriesByValue(axList, gd) {
28892889
'min': function(values) {return Lib.aggNums(Math.min, null, values);},
28902890
'max': function(values) {return Lib.aggNums(Math.max, null, values);},
28912891
'sum': function(values) {return Lib.aggNums(function(a, b) { return a + b;}, null, values);},
2892-
'value': function(values) {return Lib.aggNums(function(a, b) { return a + b;}, null, values);},
2892+
'total': function(values) {return Lib.aggNums(function(a, b) { return a + b;}, null, values);},
28932893
'mean': function(values) {return Lib.mean(values);},
28942894
'median': function(values) {return Lib.median(values);}
28952895
};

test/jasmine/tests/calcdata_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -989,15 +989,15 @@ describe('calculated data and points', function() {
989989
.then(done);
990990
}
991991

992-
['value ascending', 'value descending'].forEach(function(categoryorder) {
992+
['total ascending', 'total descending'].forEach(function(categoryorder) {
993993
it('sorts ' + axName + ' by ' + categoryorder + ' for trace type ' + trace.type, function(done) {
994994
var data = [7, 2, 3];
995995
var baseMock = {data: [makeData(trace.type, axName, cat, data)], layout: {}};
996996
baseMock.layout[axName] = { type: 'category', categoryorder: categoryorder};
997997

998998
// Set expectations
999999
var finalOrder = ['b', 'c', 'a'];
1000-
if(categoryorder === 'value descending') finalOrder.reverse();
1000+
if(categoryorder === 'total descending') finalOrder.reverse();
10011001
var expectedAgg = [['a', 7], ['b', 2], ['c', 3]];
10021002

10031003
if(trace.type === 'ohlc' || trace.type === 'candlestick') expectedAgg = [['a', 14], ['b', 4], ['c', 6]];
@@ -1012,7 +1012,7 @@ describe('calculated data and points', function() {
10121012
var data = [7, 2, 3];
10131013
var data2 = [5, 4, 2];
10141014
var baseMock = { data: [makeData(type, axName, cat, data), makeData(type, axName, cat, data2)], layout: {}};
1015-
baseMock.layout[axName] = { type: 'category', categoryorder: 'value ascending'};
1015+
baseMock.layout[axName] = { type: 'category', categoryorder: 'total ascending'};
10161016

10171017
var expectedAgg = [['a', data[0] + data2[0]], ['b', data[1] + data2[1]], ['c', data[2] + data2[2]]];
10181018
if(type === 'ohlc' || type === 'candlestick') expectedAgg = [['a', 2 * expectedAgg[0][1]], ['b', 2 * expectedAgg[1][1]], ['c', 2 * expectedAgg[2][1]]];
@@ -1026,7 +1026,7 @@ describe('calculated data and points', function() {
10261026
var data = [7, 2, 3];
10271027
var data2 = [5, 4, 2];
10281028
var baseMock = { data: [makeData(type, axName, cat, data), makeData(type, axName, cat, data2)], layout: {}};
1029-
baseMock.layout[axName] = { type: 'category', categoryorder: 'value ascending'};
1029+
baseMock.layout[axName] = { type: 'category', categoryorder: 'total ascending'};
10301030

10311031
// Hide second trace
10321032
baseMock.data[1].visible = 'legendonly';

0 commit comments

Comments
 (0)