Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bab11d7

Browse filesBrowse files
committed
sort categories by value: draft for scattergl
1 parent 9899a63 commit bab11d7
Copy full SHA for bab11d7

File tree

Expand file treeCollapse file tree

1 file changed

+18
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-2
lines changed

‎src/plots/plots.js

Copy file name to clipboardExpand all lines: src/plots/plots.js
+18-2Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,21 +2893,37 @@ function sortAxisCategoriesByValue(axList, gd) {
28932893

28942894
// Collect values across dimensions
28952895
if(fullData.type === 'splom') {
2896-
// Find which dimension the current axis is mapped
2896+
// Find which dimension the current axis is representing
28972897
var currentDimensionIndex = cdi.trace[ax._id.charAt(0) + 'axes'].indexOf(ax._id);
28982898

28992899
var categories = cdi.trace.dimensions[currentDimensionIndex].values;
29002900
for(l = 0; l < categories.length; l++) {
29012901
cat = categories[l];
29022902
catIndex = ax._categoriesMap[cat];
29032903

2904-
// Collect values over all dimensions
2904+
// Collect values over all other dimensions
29052905
for(o = 0; o < cdi.trace.dimensions.length; o++) {
29062906
if(o === currentDimensionIndex) continue;
29072907
var dimension = cdi.trace.dimensions[o];
29082908
categoriesValue[catIndex][1].push(dimension.values[l]);
29092909
}
29102910
}
2911+
} else if(fullData.type === 'scattergl') {
2912+
// TODO: FIXME sorting scattergl breaks
2913+
for(l = 0; l < cdi.t.x.length; l++) {
2914+
if(ax._id.charAt(0) === 'x') {
2915+
cat = cdi.t.x[l];
2916+
catIndex = cat;
2917+
value = cdi.t.y[l];
2918+
}
2919+
2920+
if(ax._id.charAt(0) === 'y') {
2921+
cat = cdi.t.y[l];
2922+
catIndex = cat;
2923+
value = cdi.t.x[l];
2924+
}
2925+
categoriesValue[catIndex][1].push(value);
2926+
}
29112927
} else {
29122928
if(ax._id.charAt(0) === 'x') {
29132929
cat = cdi.p + 1 ? cdi.p : cdi.x;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.