Skip to content

Commit fed71e7

Browse files
author
Jon M. Mease
committed
eslint fixes
1 parent b3b73a6 commit fed71e7

File tree

4 files changed

+85
-89
lines changed

4 files changed

+85
-89
lines changed

src/traces/parcats/calc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ module.exports = function calc(gd, trace) {
4545
// UniqueInfo per dimension
4646
var uniqueInfoDims = trace.dimensions.filter(visible).map(function(dim) {
4747
var categoryValues;
48-
if (dim.categoryorder === 'trace') {
48+
if(dim.categoryorder === 'trace') {
4949
// Use order of first occurrence in trace
5050
categoryValues = null;
51-
} else if (dim.categoryorder === 'array') {
51+
} else if(dim.categoryorder === 'array') {
5252
// Use categories specified in `categoryarray` first, then add extra to the end in trace order
5353
categoryValues = dim.categoryarray;
5454
} else {
5555
// Get all categories up front so we can order them
5656
// Should we check for numbers as sort numerically?
5757
categoryValues = filterUnique(dim.values).sort();
58-
if (dim.categoryorder === 'category descending') {
58+
if(dim.categoryorder === 'category descending') {
5959
categoryValues = categoryValues.reverse();
6060
}
6161
}

src/traces/parcats/defaults.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ var colorscaleDefaults = require('../../components/colorscale/defaults');
1414
var handleDomainDefaults = require('../../plots/domain').defaults;
1515
var handleArrayContainerDefaults = require('../../plots/array_container_defaults');
1616

17-
var handleCategoryOrderDefaults = require('../../plots/cartesian/category_order_defaults');
1817
var attributes = require('./attributes');
1918
var mergeLength = require('../parcoords/merge_length');
2019

src/traces/parcats/parcats.js

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ function performPlot(parcatsModels, graphDiv, layout, svg) {
210210
.attr('cursor',
211211
/** @param {CategoryBandViewModel} bandModel*/
212212
function(bandModel) {
213-
if (bandModel.parcatsViewModel.arrangement === 'fixed') {
214-
return 'default'
215-
} else if (bandModel.parcatsViewModel.arrangement === 'perpendicular') {
216-
return 'ns-resize'
213+
if(bandModel.parcatsViewModel.arrangement === 'fixed') {
214+
return 'default';
215+
} else if(bandModel.parcatsViewModel.arrangement === 'perpendicular') {
216+
return 'ns-resize';
217217
} else {
218-
return 'move'
219-
}
220-
});
218+
return 'move';
219+
}
220+
});
221221

222222
styleBandsNoHover(bandsSelectionEnter);
223223

@@ -267,7 +267,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) {
267267
})
268268
.each(
269269
/** @param {CategoryViewModel} catModel*/
270-
function(catModel){
270+
function(catModel) {
271271
Drawing.font(d3.select(this), catModel.parcatsViewModel.categorylabelfont);
272272
});
273273

@@ -283,10 +283,10 @@ function performPlot(parcatsModels, graphDiv, layout, svg) {
283283
.attr('cursor',
284284
/** @param {CategoryViewModel} catModel*/
285285
function(catModel) {
286-
if (catModel.parcatsViewModel.arrangement === 'fixed') {
286+
if(catModel.parcatsViewModel.arrangement === 'fixed') {
287287
return 'default';
288288
} else {
289-
return 'ew-resize'
289+
return 'ew-resize';
290290
}
291291
})
292292
.attr('x', function(d) {
@@ -303,7 +303,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) {
303303
})
304304
.each(
305305
/** @param {CategoryViewModel} catModel*/
306-
function(catModel){
306+
function(catModel) {
307307
Drawing.font(d3.select(this), catModel.parcatsViewModel.labelfont);
308308
});
309309

@@ -436,10 +436,10 @@ function mouseoverPath(d) {
436436

437437
// Build hover text
438438
var hovertextParts = [];
439-
if (d.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) {
439+
if(d.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) {
440440
hovertextParts.push(['Count:', d.model.count].join(' '));
441441
}
442-
if (d.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) {
442+
if(d.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) {
443443
hovertextParts.push(['P:', (d.model.count / d.parcatsViewModel.model.count).toFixed(3)].join(' '));
444444
}
445445

@@ -513,7 +513,7 @@ function buildPointsArrayForPath(d) {
513513
* @param {PathViewModel} d
514514
*/
515515
function clickPath(d) {
516-
if (d.parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) {
516+
if(d.parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) {
517517
// hoverinfo it's skip, so interaction events aren't disabled
518518
var points = buildPointsArrayForPath(d);
519519
d.parcatsViewModel.graphDiv.emit('plotly_click', {points: points, event: d3.event});
@@ -729,13 +729,13 @@ function createHoverLabelForCategoryHovermode(rootBBox, bandElement) {
729729

730730
// Hover label text
731731
var hoverinfoParts = [];
732-
if (catViewModel.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) {
733-
hoverinfoParts.push(['Count:', catViewModel.model.count].join(' '))
732+
if(catViewModel.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) {
733+
hoverinfoParts.push(['Count:', catViewModel.model.count].join(' '));
734734
}
735-
if (catViewModel.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) {
735+
if(catViewModel.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) {
736736
hoverinfoParts.push([
737737
'P(' + catViewModel.model.categoryLabel + '):',
738-
(catViewModel.model.count / catViewModel.parcatsViewModel.model.count).toFixed(3)].join(' '))
738+
(catViewModel.model.count / catViewModel.parcatsViewModel.model.count).toFixed(3)].join(' '));
739739
}
740740

741741
var hovertext = hoverinfoParts.join('<br>');
@@ -773,7 +773,7 @@ function createHoverLabelForDimensionHovermode(rootBBox, bandElement) {
773773
allHoverlabels.push(createHoverLabelForCategoryHovermode(rootBBox, bandNode));
774774
});
775775

776-
return allHoverlabels
776+
return allHoverlabels;
777777
}
778778

779779
/**
@@ -837,10 +837,10 @@ function createHoverLabelForColorHovermode(rootBBox, bandElement) {
837837

838838
// Hover label text
839839
var hoverinfoParts = [];
840-
if (catViewModel.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) {
841-
hoverinfoParts.push(['Count:', bandColorCount].join(' '))
840+
if(catViewModel.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) {
841+
hoverinfoParts.push(['Count:', bandColorCount].join(' '));
842842
}
843-
if (catViewModel.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) {
843+
if(catViewModel.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) {
844844
var pColorAndCatLable = 'P(color ∩ ' + catLabel + '): ';
845845
var pColorAndCatValue = (bandColorCount / totalCount).toFixed(3);
846846
var pColorAndCatRow = pColorAndCatLable + pColorAndCatValue;
@@ -889,7 +889,7 @@ function mouseoverCategoryBand(bandViewModel) {
889889

890890
// Mouse
891891
var mouseY = d3.mouse(this)[1];
892-
if (mouseY < -1) {
892+
if(mouseY < -1) {
893893
// Hover is above above the category rectangle (probably the dimension title text)
894894
return;
895895
}
@@ -903,7 +903,7 @@ function mouseoverCategoryBand(bandViewModel) {
903903
var bandElement = this;
904904

905905
// Handle style and events
906-
if (hovermode === 'color') {
906+
if(hovermode === 'color') {
907907
styleForColorHovermode(bandElement);
908908
emitPointsEventColorHovermode(bandElement, 'plotly_hover', d3.event);
909909
} else {
@@ -914,15 +914,15 @@ function mouseoverCategoryBand(bandViewModel) {
914914
// Handle hover label
915915
if(bandViewModel.parcatsViewModel.hoverinfoItems.indexOf('none') === -1) {
916916
var hoverItems;
917-
if (hovermode === 'category') {
917+
if(hovermode === 'category') {
918918
hoverItems = createHoverLabelForCategoryHovermode(rootBBox, bandElement);
919-
} else if (hovermode === 'color') {
919+
} else if(hovermode === 'color') {
920920
hoverItems = createHoverLabelForColorHovermode(rootBBox, bandElement);
921-
} else if (hovermode === 'dimension') {
921+
} else if(hovermode === 'dimension') {
922922
hoverItems = createHoverLabelForDimensionHovermode(rootBBox, bandElement);
923923
}
924924

925-
if (hoverItems) {
925+
if(hoverItems) {
926926
Fx.multiHovers(hoverItems, {
927927
container: fullLayout._hoverlayer.node(),
928928
outerContainer: fullLayout._paper.node(),
@@ -964,10 +964,9 @@ function mouseoutCategory(bandViewModel) {
964964
var bandElement = this;
965965

966966
// Handle style and events
967-
if (hovermode === 'color') {
967+
if(hovermode === 'color') {
968968
emitPointsEventColorHovermode(bandElement, 'plotly_unhover', d3.event);
969969
} else {
970-
console.log('mouseoutCategory: ' + hovermode);
971970
emitPointsEventCategoryHovermode(bandElement, 'plotly_unhover', d3.event);
972971
}
973972
}
@@ -982,8 +981,8 @@ function mouseoutCategory(bandViewModel) {
982981
function dragDimensionStart(d) {
983982

984983
// Check if dragging is supported
985-
if (d.parcatsViewModel.arrangement === 'fixed') {
986-
return
984+
if(d.parcatsViewModel.arrangement === 'fixed') {
985+
return;
987986
}
988987

989988
// Save off initial drag indexes for dimension
@@ -1044,8 +1043,8 @@ function dragDimensionStart(d) {
10441043
function dragDimension(d) {
10451044

10461045
// Check if dragging is supported
1047-
if (d.parcatsViewModel.arrangement === 'fixed') {
1048-
return
1046+
if(d.parcatsViewModel.arrangement === 'fixed') {
1047+
return;
10491048
}
10501049

10511050
d.dragHasMoved = true;
@@ -1103,24 +1102,24 @@ function dragDimension(d) {
11031102
}
11041103

11051104
// Update dimension position
1106-
if (d.dragCategoryDisplayInd === null || d.parcatsViewModel.arrangement === 'freeform') {
1105+
if(d.dragCategoryDisplayInd === null || d.parcatsViewModel.arrangement === 'freeform') {
11071106
dragDimension.model.dragX = d3.event.x;
11081107

11091108
// Check for dimension swaps
11101109
var prevDimension = d.parcatsViewModel.dimensions[prevDimInd];
11111110
var nextDimension = d.parcatsViewModel.dimensions[nextDimInd];
11121111

1113-
if (prevDimension !== undefined) {
1114-
if (dragDimension.model.dragX < (prevDimension.x + prevDimension.width)) {
1112+
if(prevDimension !== undefined) {
1113+
if(dragDimension.model.dragX < (prevDimension.x + prevDimension.width)) {
11151114

11161115
// Swap display inds
11171116
dragDimension.model.displayInd = prevDimension.model.displayInd;
11181117
prevDimension.model.displayInd = dragDimInd;
11191118
}
11201119
}
11211120

1122-
if (nextDimension !== undefined) {
1123-
if ((dragDimension.model.dragX + dragDimension.width) > nextDimension.x) {
1121+
if(nextDimension !== undefined) {
1122+
if((dragDimension.model.dragX + dragDimension.width) > nextDimension.x) {
11241123

11251124
// Swap display inds
11261125
dragDimension.model.displayInd = nextDimension.model.displayInd;
@@ -1149,8 +1148,8 @@ function dragDimension(d) {
11491148
function dragDimensionEnd(d) {
11501149

11511150
// Check if dragging is supported
1152-
if (d.parcatsViewModel.arrangement === 'fixed') {
1153-
return
1151+
if(d.parcatsViewModel.arrangement === 'fixed') {
1152+
return;
11541153
}
11551154

11561155
if(d.dragDimensionDisplayInd === null) {
@@ -1192,11 +1191,11 @@ function dragDimensionEnd(d) {
11921191

11931192
// Sort a shallow copy of the category models by display index
11941193
var sortedCategoryModels = d.model.categories.slice().sort(
1195-
function (a, b) { return a.displayInd - b.displayInd });
1194+
function(a, b) { return a.displayInd - b.displayInd; });
11961195

11971196
// Get new categoryarray and categorylabels values
1198-
var newCategoryArray = sortedCategoryModels.map(function (v) { return v.categoryValue });
1199-
var newCategoryLabels = sortedCategoryModels.map(function (v) { return v.categoryLabel });
1197+
var newCategoryArray = sortedCategoryModels.map(function(v) { return v.categoryValue; });
1198+
var newCategoryLabels = sortedCategoryModels.map(function(v) { return v.categoryLabel; });
12001199

12011200
restyleData['dimensions[' + d.model.containerInd + '].categoryarray'] = [newCategoryArray];
12021201
restyleData['dimensions[' + d.model.containerInd + '].categorylabels'] = [newCategoryLabels];
@@ -1207,8 +1206,8 @@ function dragDimensionEnd(d) {
12071206
// Handle potential click event
12081207
// ----------------------------
12091208
if(d.parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) {
1210-
if (!d.dragHasMoved && d.potentialClickBand) {
1211-
if (d.parcatsViewModel.hovermode === 'color') {
1209+
if(!d.dragHasMoved && d.potentialClickBand) {
1210+
if(d.parcatsViewModel.hovermode === 'color') {
12121211
emitPointsEventColorHovermode(d.potentialClickBand, 'plotly_click', d3.event.sourceEvent);
12131212
} else {
12141213
emitPointsEventCategoryHovermode(d.potentialClickBand, 'plotly_click', d3.event.sourceEvent);
@@ -1455,7 +1454,7 @@ function createParcatsViewModel(graphDiv, layout, wrappedParcatsModel) {
14551454
// Handle hover info
14561455
// -----------------
14571456
var hoverinfoItems;
1458-
if (trace.hoverinfo === 'all') {
1457+
if(trace.hoverinfo === 'all') {
14591458
hoverinfoItems = ['count', 'probability'];
14601459
} else {
14611460
hoverinfoItems = trace.hoverinfo.split('+');

0 commit comments

Comments
 (0)