Skip to content

Commit 8c09944

Browse files
committed
add "matches" + "scaleanchor" mock
1 parent 9f2fad1 commit 8c09944

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

src/plot_api/subroutines.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,8 @@ exports.doAutoRangeAndConstraints = function(gd) {
708708
doAutoRange(gd, ax);
709709
}
710710

711+
enforceAxisConstraints(gd);
712+
711713
// TODO bypass this when matching axes aren't autoranged?
712714
for(var j = 0; j < matchGroups.length; j++) {
713715
var group = matchGroups[j];
@@ -737,9 +739,6 @@ exports.doAutoRangeAndConstraints = function(gd) {
737739
ax.setScale(0);
738740
}
739741
}
740-
741-
// TODO before or after matching axes?
742-
enforceAxisConstraints(gd);
743742
};
744743

745744
// An initial paint must be completed before these components can be

src/plots/cartesian/constraints.js

-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, a
8181
found = true;
8282
}
8383

84-
// TODO what happens when both scaleanchor and matches are present???
85-
8684
if(matches) {
8785
updateConstraintGroups(matchGroups, opts.thisGroup, thisID, matches, 1);
8886
found = true;
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"data":[
3+
{"x": [0,1,1,0,0,1,1,2,2,3,3,2,2,3], "y": [0,0,1,1,3,3,2,2,3,3,1,1,0,0]},
4+
{"x": [0,1,2,3], "y": [1,2,4,8], "yaxis":"y2"}
5+
],
6+
"layout":{
7+
"width": 500,
8+
"height": 500,
9+
"xaxis": {
10+
"constrain": "domain"
11+
},
12+
"yaxis": {
13+
"scaleanchor": "x",
14+
"constrain": "domain",
15+
"domain": [0, 0.45],
16+
"title": {"text": "1:1<br>matching y range above"}
17+
},
18+
"yaxis2": {
19+
"matches": "y",
20+
"constrain": "domain",
21+
"scaleanchor": "x",
22+
"scaleratio": 0.2,
23+
"domain": [0.55, 1],
24+
"title": {"text": "1:5<br>matching y range below"}
25+
},
26+
"showlegend": false
27+
}
28+
}

0 commit comments

Comments
 (0)