Skip to content

Commit c48ae1c

Browse files
committed
fix category init for non-matching axes on graphs with matching axes
1 parent b5663aa commit c48ae1c

File tree

3 files changed

+77
-4
lines changed

3 files changed

+77
-4
lines changed

src/plots/cartesian/set_convert.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,21 @@ module.exports = function setConvert(ax, fullLayout) {
575575

576576
// should skip if not category nor multicategory
577577
ax.clearCalc = function() {
578+
var init = function() {
579+
ax._categories = [];
580+
ax._categoriesMap = {};
581+
};
582+
578583
var matchGroups = fullLayout._axisMatchGroups;
579584

580585
if(matchGroups && matchGroups.length) {
586+
var found = false;
587+
581588
for(var i = 0; i < matchGroups.length; i++) {
582589
var group = matchGroups[i];
583590

584591
if(group[axId]) {
592+
found = true;
585593
var categories = null;
586594
var categoriesMap = null;
587595

@@ -598,14 +606,14 @@ module.exports = function setConvert(ax, fullLayout) {
598606
ax._categories = categories;
599607
ax._categoriesMap = categoriesMap;
600608
} else {
601-
ax._categories = [];
602-
ax._categoriesMap = {};
609+
init();
603610
}
604611
}
612+
613+
if(!found) init();
605614
}
606615
} else {
607-
ax._categories = [];
608-
ax._categoriesMap = {};
616+
init();
609617
}
610618

611619
if(ax._initialCategories) {
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"data": [
3+
{
4+
"y": [ "a", "b" ],
5+
"x": [ 1, 2 ],
6+
"xaxis": "x",
7+
"yaxis": "y"
8+
},
9+
{
10+
"y": [ "a", "b" ],
11+
"x": [ 1, 2 ],
12+
"xaxis": "x2",
13+
"yaxis": "y"
14+
},
15+
{
16+
"x": [ "a", "b" ],
17+
"y": [ 1, 2 ],
18+
"xaxis": "x3",
19+
"yaxis": "y2"
20+
},
21+
{
22+
"x": [ "a", "b" ],
23+
"y": [ 1, 2 ],
24+
"xaxis": "x3",
25+
"yaxis": "y3"
26+
}
27+
],
28+
"layout": {
29+
"showlegend": false,
30+
"xaxis": {
31+
"title": {
32+
"text": "matches ->"
33+
},
34+
"domain": [ 0, 0.5 ]
35+
},
36+
"xaxis2": {
37+
"title": {
38+
"text": "matches <-"
39+
},
40+
"domain": [ 0.5, 1 ],
41+
"matches": "x"
42+
},
43+
"xaxis3": {
44+
"anchor": "y2"
45+
},
46+
"yaxis": {
47+
"domain": [ 0, 0.4 ]
48+
},
49+
"yaxis2": {
50+
"title": {
51+
"text": "matches<br>->"
52+
},
53+
"anchor": "x3",
54+
"domain": [ 0.5, 0.75 ]
55+
},
56+
"yaxis3": {
57+
"anchor": "x3",
58+
"title": {
59+
"text": "matches<br><-"
60+
},
61+
"domain": [ 0.75, 1 ],
62+
"matches": "y2"
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)