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

Sign up
Appearance settings

Commit b343fcc

Browse files
Fix selection of histograms with multiple traces (#2771)
* sort indices only if a single trace exists
1 parent f18576b commit b343fcc

File tree

1 file changed

+13
-4
lines changed
  • packages/javascript/plotlywidget/src

1 file changed

+13
-4
lines changed

‎packages/javascript/plotlywidget/src/Figure.js‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var widgets = require("@jupyter-widgets/base");
22
var _ = require("lodash");
33

4-
window.PlotlyConfig = {MathJaxConfig: "local"};
4+
window.PlotlyConfig = {MathJaxConfig: "local"};
55
var Plotly = require("plotly.js/dist/plotly");
66
var semver_range = "^" + require("../package.json").version;
77

@@ -919,9 +919,18 @@ var FigureView = widgets.DOMWidgetView.extend({
919919
pointsObject["trace_indexes"][flatPointIndex] = pointObjects[p]["curveNumber"];
920920
}
921921
}
922-
pointsObject["point_indexes"].sort(function(a, b) {
923-
return a - b;
924-
});
922+
923+
let single_trace = true;
924+
for (let i = 1; i < numPointNumbers; i++) {
925+
single_trace = single_trace && (pointsObject["trace_indexes"][i - 1] === pointsObject["trace_indexes"][i])
926+
if (!single_trace) break;
927+
}
928+
if (single_trace) {
929+
pointsObject["point_indexes"].sort((function (a, b) {
930+
return a - b
931+
}))
932+
}
933+
925934
} else {
926935
for (var p = 0; p < numPoints; p++) {
927936
pointsObject["trace_indexes"][p] = pointObjects[p]["curveNumber"];

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /