Skip to content

Commit 547ef52

Browse files
committed
Resolved ESLnt warnings
1 parent 5a79014 commit 547ef52

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/plots/plots.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,6 +3207,10 @@ function sortAxisCategoriesByValue(axList, gd) {
32073207
median: function(values) {return Lib.median(values);}
32083208
};
32093209

3210+
function sortValues(a, b) {
3211+
return order === 'descending' ? b[1] - a[1] : a[1] - b[1];
3212+
}
3213+
32103214
for(i = 0; i < axList.length; i++) {
32113215
var ax = axList[i];
32123216
if(ax.type !== 'category') continue;
@@ -3327,19 +3331,15 @@ function sortAxisCategoriesByValue(axList, gd) {
33273331
]);
33283332
}
33293333

3330-
function sortValues(a, b) {
3331-
return order === 'descending' ? b[1] - a[1] : a[1] - b[1];
3332-
}
3333-
33343334
// Sort by aggregated value
3335-
categoriesAggregatedValue.sort(sortValues);
3336-
3335+
categoriesAggregatedValue.sort(sortValues);
3336+
33373337
ax._categoriesAggregatedValue = categoriesAggregatedValue;
33383338

33393339
// Set new category order
33403340
ax._initialCategories = categoriesAggregatedValue.map(function(c) {
33413341
return c[0];
3342-
});
3342+
});
33433343

33443344
// Sort all matching axes
33453345
affectedTraces = affectedTraces.concat(ax.sortByInitialCategories());

test/jasmine/tests/calcdata_test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,28 +1035,28 @@ describe('calculated data and points', function() {
10351035
});
10361036
}
10371037

1038-
supportedCartesianTraces.forEach(function(trace) {
1038+
supportedCartesianTraces.forEach(function(trace) {
10391039
['xaxis', 'yaxis'].forEach(function(axName) {
10401040
if(axName === 'yaxis' && oneOrientationTraces.indexOf(trace.type) !== -1) return;
10411041

1042-
function checkAggregatedValue(baseMock, expectedAgg, finalOrder, done) {
1042+
function checkAggregatedValue(baseMock, expectedAgg, finalOrder, done) {
10431043
var mock = Lib.extendDeep({}, baseMock);
1044-
1044+
10451045
if(mock.data[0].type.match(/histogram/)) {
10461046
for(i = 0; i < mock.data.length; i++) {
10471047
mock.data[i][axName === 'yaxis' ? 'y' : 'x'].push('a');
1048-
mock.data[i][axName === 'yaxis' ? 'x' : 'y'].push(7);
1048+
mock.data[i][axName === 'yaxis' ? 'x' : 'y'].push(7);
10491049
}
10501050
}
1051-
1051+
10521052
Plotly.newPlot(gd, mock)
1053-
.then(function(gd) {
1053+
.then(function(gd) {
10541054
var agg = gd._fullLayout[trace.type === 'splom' ? 'xaxis' : axName]._categoriesAggregatedValue.sort(function(a, b) {
10551055
return a[0] > b[0] ? 1 : -1;
10561056
});
10571057
expect(agg).toEqual(expectedAgg, 'wrong aggregation for ' + axName);
10581058

1059-
if(finalOrder) {
1059+
if(finalOrder) {
10601060
expect(gd._fullLayout[trace.type === 'splom' ? 'xaxis' : axName]._categories).toEqual(finalOrder, 'wrong order');
10611061
}
10621062
})
@@ -1074,13 +1074,13 @@ describe('calculated data and points', function() {
10741074
if(categoryorder === 'total descending') finalOrder.reverse();
10751075
var expectedAgg = [['a', 7], ['b', 2], ['c', 3]];
10761076

1077-
if(trace.type === 'ohlc' || trace.type === 'candlestick'){
1077+
if(trace.type === 'ohlc' || trace.type === 'candlestick') {
10781078
expectedAgg = [['a', 14], ['b', 4], ['c', 6]];
1079-
if(categoryorder === 'total descending') finalOrder= ['a', 'c', 'b']
1079+
if(categoryorder === 'total descending') finalOrder = ['a', 'c', 'b'];
10801080
}
1081-
if(trace.type.match(/histogram/)){
1081+
if(trace.type.match(/histogram/)) {
10821082
expectedAgg = [['a', 2], ['b', 1], ['c', 1]];
1083-
if(categoryorder === 'total descending') finalOrder= ['a', 'b', 'c']
1083+
if(categoryorder === 'total descending') finalOrder = ['a', 'b', 'c'];
10841084
}
10851085

10861086
checkAggregatedValue(baseMock, expectedAgg, finalOrder, done);

0 commit comments

Comments
 (0)