Skip to content

Commit 32488f1

Browse files
Changed rangeslidermode values for more clarity
1 parent 5e0486a commit 32488f1

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/components/rangeslider/draw.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = function(gd) {
136136

137137
opts._rl = [range0, range1];
138138

139-
if(oppAxisOpts.rangeslidermode) {
139+
if(oppAxisOpts.rangeslidermode === 'auto' || oppAxisOpts.rangeslidermode === 'fixed') {
140140
var range0OppAxis = oppAxisOpts.r2l(oppAxisOpts.rangesliderrange[0]),
141141
range1OppAxis = oppAxisOpts.r2l(oppAxisOpts.rangesliderrange[1]),
142142
distOppAxis = range1OppAxis - range0OppAxis;
@@ -305,7 +305,7 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts) {
305305
.attr('x', pixelMax)
306306
.attr('width', opts._width - pixelMax);
307307

308-
if(oppAxisOpts.rangeslidermode) {
308+
if(oppAxisOpts.rangeslidermode === 'auto' || oppAxisOpts.rangeslidermode === 'fixed') {
309309
var pixelMinOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[1])),
310310
pixelMaxOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[0]));
311311

@@ -428,7 +428,7 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) {
428428
mockFigure.layout[oppAxisName] = {
429429
type: oppAxisOpts.type,
430430
domain: [0, 1],
431-
range: oppAxisOpts.rangeslidermode ? oppAxisOpts.rangesliderrange.slice() : oppAxisOpts.range.slice(),
431+
range: (oppAxisOpts.rangeslidermode === 'auto' || oppAxisOpts.rangeslidermode === 'fixed') ? oppAxisOpts.rangesliderrange.slice() : oppAxisOpts.range.slice(),
432432
calendar: oppAxisOpts.calendar
433433
};
434434

@@ -495,7 +495,7 @@ function drawMasks(rangeSlider, gd, axisOpts, opts, oppAxisOpts) {
495495
.call(Color.fill, constants.maskColor);
496496

497497
// masks used for oppAxis zoom
498-
if(oppAxisOpts.rangeslidermode) {
498+
if(oppAxisOpts.rangeslidermode === 'auto' || oppAxisOpts.rangeslidermode === 'fixed') {
499499
var maskMinOppAxis = rangeSlider.selectAll('rect.' + constants.maskMinOppAxisClassName)
500500
.data([0]);
501501

src/plots/cartesian/axis_defaults.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
5555
containerOut.cleanRange();
5656

5757
if(letter === 'y') {
58-
coerce('rangeslidermode', containerIn.rangesliderrange ?
59-
containerOut.isValidRange(containerIn.rangesliderrange) : 'auto');
58+
if(containerIn.rangesliderrange) {
59+
coerce('rangeslidermode', 'auto');
60+
} else if(containerOut.isValidRange(containerIn.rangesliderrange)) {
61+
coerce('rangeslidermode', 'fixed');
62+
} else {
63+
coerce('rangeslidermode', 'match');
64+
}
6065

6166
coerce('rangesliderrange');
6267
containerOut.cleanRange('rangesliderrange');

src/plots/cartesian/layout_attributes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ module.exports = {
130130
},
131131
rangeslidermode: {
132132
valType: 'enumerated',
133-
values: ['auto', true, false],
133+
values: ['auto', 'fixed', 'match'],
134134
dflt: 'auto',
135135
role: 'style',
136136
editType: 'calc',
@@ -139,8 +139,8 @@ module.exports = {
139139
'the rangeslider use the same value than in the main plot',
140140
'when zooming in/out.',
141141
'If *auto*, the autorange will be used.',
142-
'If *true*, the `rangesliderrange` is used.',
143-
'If *false*, the current range is used.'
142+
'If *fixed*, the `rangesliderrange` is used.',
143+
'If *match*, the current range is used.'
144144
].join(' ')
145145
},
146146
rangesliderrange: {

0 commit comments

Comments
 (0)