Multi-category sorting misbehaves with missing categories
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 18.3k
- Forks
- 2k
- Ø Merge
- 2 T. 12 Std.
- Gemergte PRs (30 T.)
- 28
Beschreibung
Originally reported in https://github.com/plotly/plotly.py/issues/1491.
There seems to a multi-category sorting bug that wasn't fixed by #3362.
CodePen: https://codepen.io/jonmmease/pen/VNeEqq?editors=1010
var fig = {
"data": [
{
"name": "Fruits",
"type": "bar",
"x": [
[
2017,
2017,
2017,
2017,
2017,
2017,
2017,
2017,
2018,
2018,
2018,
2018
],
[
4,
5,
6,
8,
9,
10,
11,
12,
1,
2,
3,
4
]
],
"y": [
57246.0,
1587.0,
63189.0,
30680.0,
26071.0,
117519.0,
27519.0,
42643.0,
8559.0,
22355.0,
59363.0,
62955.0
]
},
{
"name": "Price",
"type": "scatter",
"x": [
[
2017,
2017,
2017,
2017,
2017,
2017,
2017,
2017,
2018,
2018,
2018,
2018
],
[
4,
5,
6,
8,
9,
10,
11,
12,
1,
2,
3,
4
]
],
"y": [
0.22991999,
0.27284184,
0.18438336,
0.24866362,
0.18280848,
0.19382398,
0.17268069,
0.18802617,
0.17560463,
0.13415343,
0.14773512,
0.31319196
],
"yaxis": "y2"
}
],
"layout": {
"height": 600,
"showlegend": true,
"yaxis": {
"showgrid": true,
"title": {
"text": "Fruits volume"
}
},
"yaxis2": {
"anchor": "x",
"overlaying": "y",
"showgrid": false,
"side": "right",
"title": {
"text": "Price per unit"
}
}
}
}
Plotly.newPlot('myDiv', fig, {showSendToCloud: true});

The problem is that in the second multi-category (2018), the 4 is sorted before 1, 2, 3 even though they are specified in ascending sorted order.
As noted in https://github.com/plotly/plotly.py/issues/1491, this seems to happen for categories that are not present in the first multi-category (2017).
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Verhalten anhand des bereitgestellten CodePen-Beispiels und der Plotly.newPlot-Konfiguration, mit Fokus auf die Sortierung einer Multi-Category-Achse, wenn eine Kategorie nur in der späteren Gruppe vorkommt. Vergleiche die angezeigte Reihenfolge mit der angegebenen aufsteigenden Reihenfolge; abgeschlossen bedeutet, dass die zweite Multi-Category in der Reihenfolge 1, 2, 3, 4 sortiert wird und dabei das berichtete Verhalten im Beispiel erhalten bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100