Skip to content

Commit 3103fd7

Browse files
authored
Merge pull request #4127 from plotly/rangeslider-l-positioning-fix
Use gs.l not margin.l to position rangeslider
2 parents c91f88b + 9ce185d commit 3103fd7

File tree

3 files changed

+127
-5
lines changed

3 files changed

+127
-5
lines changed

src/components/rangeslider/draw.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,18 @@ module.exports = function(gd) {
106106

107107
// update range slider dimensions
108108

109-
var margin = fullLayout.margin;
110-
var graphSize = fullLayout._size;
109+
var gs = fullLayout._size;
111110
var domain = axisOpts.domain;
112111
var tickHeight = opts._tickHeight;
113112

114113
var oppBottom = opts._oppBottom;
115114

116-
opts._width = graphSize.w * (domain[1] - domain[0]);
115+
opts._width = gs.w * (domain[1] - domain[0]);
117116

118-
var x = Math.round(margin.l + (graphSize.w * domain[0]));
117+
var x = Math.round(gs.l + (gs.w * domain[0]));
119118

120119
var y = Math.round(
121-
graphSize.t + graphSize.h * (1 - oppBottom) +
120+
gs.t + gs.h * (1 - oppBottom) +
122121
tickHeight +
123122
opts._offsetShift + constants.extraPad
124123
);
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
{
2+
"data": [
3+
{
4+
"x": [1, 2, 3],
5+
"y": [44, 88, 132],
6+
"name": "trace0"
7+
},
8+
{
9+
"x": [1, 2, 3],
10+
"y": [88, 176, 264],
11+
"name": "trace1",
12+
"yaxis": "y2"
13+
},
14+
{
15+
"x": [1, 2, 3],
16+
"y": [132, 264, 396.00000000000006],
17+
"name": "trace2"
18+
},
19+
{
20+
"x": [1, 2, 3],
21+
"y": [176, 352, 528],
22+
"name": "trace3",
23+
"yaxis": "y2",
24+
"visible": "legendonly"
25+
},
26+
{
27+
"x": [1, 2, 3],
28+
"y": [220, 440, 660],
29+
"name": "trace4",
30+
"visible": "legendonly"
31+
},
32+
{
33+
"x": [1, 2, 3],
34+
"y": [264, 528, 792],
35+
"name": "trace5",
36+
"yaxis": "y2",
37+
"visible": "legendonly"
38+
},
39+
{
40+
"x": [1, 2, 3],
41+
"y": [308, 616, 923.9999999999999],
42+
"name": "trace6",
43+
"visible": "legendonly"
44+
},
45+
{
46+
"x": [1, 2, 3],
47+
"y": [351.99999999999994, 703.9999999999999, 1055.9999999999998],
48+
"name": "trace7",
49+
"yaxis": "y2",
50+
"visible": "legendonly"
51+
},
52+
{
53+
"x": [1, 2, 3],
54+
"y": [395.99999999999994, 791.9999999999999, 1187.9999999999998],
55+
"name": "trace8",
56+
"visible": "legendonly"
57+
},
58+
{
59+
"x": [1, 2, 3],
60+
"y": [439.99999999999994, 879.9999999999999, 1319.9999999999998],
61+
"name": "trace9",
62+
"yaxis": "y2",
63+
"visible": "legendonly"
64+
},
65+
{
66+
"x": [1, 2, 3],
67+
"y": [483.9999999999999, 967.9999999999998, 1451.9999999999998],
68+
"name": "trace10",
69+
"visible": "legendonly"
70+
},
71+
{
72+
"x": [1, 2, 3],
73+
"y": [527.9999999999999, 1055.9999999999998, 1583.9999999999998],
74+
"name": "trace11",
75+
"yaxis": "y2",
76+
"visible": "legendonly"
77+
},
78+
{
79+
"x": [1, 2, 3],
80+
"y": [571.9999999999999, 1143.9999999999998, 1715.9999999999995],
81+
"name": "trace12",
82+
"visible": "legendonly"
83+
},
84+
{
85+
"x": [1, 2, 3],
86+
"y": [615.9999999999999, 1231.9999999999998, 1847.9999999999995],
87+
"name": "trace13",
88+
"yaxis": "y2",
89+
"visible": "legendonly"
90+
},
91+
{
92+
"x": [1, 2, 3],
93+
"y": [659.9999999999999, 1319.9999999999998, 1979.9999999999995],
94+
"name": "trace14",
95+
"visible": "legendonly"
96+
}
97+
],
98+
"layout": {
99+
"legend": {
100+
"xanchor": "right",
101+
"yanchor": "top",
102+
"x": -0.5,
103+
"y": 1
104+
},
105+
"xaxis": {
106+
"rangeslider": {
107+
"visible": true
108+
}
109+
},
110+
"yaxis": {
111+
"title": {
112+
"text": "Count#"
113+
}
114+
},
115+
"yaxis2": {
116+
"title": {
117+
"text": "Y-2Axis"
118+
},
119+
"overlaying": "y",
120+
"side": "right"
121+
}
122+
}
123+
}

0 commit comments

Comments
 (0)