diff --git a/src/plots/plots.js b/src/plots/plots.js index 541c3333826..9210dde800a 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -2887,6 +2887,9 @@ plots.doCalcdata = function(gd, traces) { // Sort axis categories per value if specified var sorted = sortAxisCategoriesByValue(axList, gd); if(sorted.length) { + // how many box/violins plots do we have (in case they're grouped) + fullLayout._numBoxes = 0; + fullLayout._numViolins = 0; // If a sort operation was performed, run calc() again for(i = 0; i < sorted.length; i++) calci(sorted[i], true); for(i = 0; i < sorted.length; i++) calci(sorted[i], false); diff --git a/test/image/baselines/box_grouped_mean_descending.png b/test/image/baselines/box_grouped_mean_descending.png new file mode 100644 index 00000000000..62d34272637 Binary files /dev/null and b/test/image/baselines/box_grouped_mean_descending.png differ diff --git a/test/image/mocks/box_grouped_mean_descending.json b/test/image/mocks/box_grouped_mean_descending.json new file mode 100644 index 00000000000..e653073d373 --- /dev/null +++ b/test/image/mocks/box_grouped_mean_descending.json @@ -0,0 +1,119 @@ +{ + "data":[ + { + "y":[ + 0.2, + 0.2, + 0.6, + 1, + 0.5, + 0.4, + 0.2, + 0.7, + 0.9, + 0.1, + 0.5, + 0.3 + ], + "x":[ + "day 1", + "day 1", + "day 1", + "day 1", + "day 1", + "day 1", + "day 2", + "day 2", + "day 2", + "day 2", + "day 2", + "day 2" + ], + "name":"kale", + "marker":{ + "color":"#3D9970" + }, + "type":"box" + }, + { + "y":[ + 0.6, + 0.7, + 0.3, + 0.6, + 0, + 0.5, + 0.7, + 0.9, + 0.5, + 0.8, + 0.7, + 0.2 + ], + "x":[ + "day 1", + "day 1", + "day 1", + "day 1", + "day 1", + "day 1", + "day 2", + "day 2", + "day 2", + "day 2", + "day 2", + "day 2" + ], + "name":"radishes", + "marker":{ + "color":"#FF4136" + }, + "type":"box" + }, + { + "y":[ + 0.1, + 0.3, + 0.1, + 0.9, + 0.6, + 0.6, + 0.9, + 1, + 0.3, + 0.6, + 0.8, + 0.5 + ], + "x":[ + "day 1", + "day 1", + "day 1", + "day 1", + "day 1", + "day 1", + "day 2", + "day 2", + "day 2", + "day 2", + "day 2", + "day 2" + ], + "name":"carrots", + "marker":{ + "color":"#FF851B" + }, + "type":"box" + } + ], + "layout":{ + "xaxis": { + "categoryorder": "mean descending" + }, + "yaxis":{ + "zeroline":false, + "title":"normalized moisture" + }, + "boxmode":"group" + } +}