-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rangeslider allow zoom on oppaxis #2364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
519e1a7
044e633
f335258
707f432
6a7f652
fc4f082
92c6550
b30167c
91caff1
3dd91b5
00fd1d7
5e0486a
32488f1
bc2a40a
d3b6071
b496641
149ef70
54d8b58
dd48914
a8a3ee5
0ae2831
8764e4d
a17d3a8
e85e3d0
0dd8562
3929be6
e2ad33d
df85f35
fe83e07
3b6b81a
9de4e3e
f2819c8
df96a13
9c66f81
f092c44
041ce3d
23c8401
73560f6
c556f8c
43f15a7
ccb6091
6a88b24
95b8c10
4f54f62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,26 +45,28 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { | |
coerce('range'); | ||
|
||
var subplots = layoutOut._subplots; | ||
var yIds = subplots.yaxis; | ||
var yNames = Lib.simpleMap(yIds, axisIds.id2name); | ||
for(var i = 0; i < yNames.length; i++) { | ||
var yName = yNames[i]; | ||
if(!containerIn[yName]) { | ||
containerIn[yName] = {}; | ||
} | ||
if(!containerOut[yName]) { | ||
containerOut[yName] = {}; | ||
} | ||
if(subplots) { | ||
var yIds = subplots.yaxis; | ||
var yNames = Lib.simpleMap(yIds, axisIds.id2name); | ||
for(var i = 0; i < yNames.length; i++) { | ||
var yName = yNames[i]; | ||
if(!containerIn[yName]) { | ||
containerIn[yName] = {}; | ||
} | ||
if(!containerOut[yName]) { | ||
containerOut[yName] = {}; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to push rangeContainerIn = containerIn[yName] || {};
rangeContainerOut = containerOut[yName] = {}; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, it is not required anymore (it was in one of the first version). |
||
|
||
if(containerIn[yName].range && layoutOut[yName].isValidRange(containerIn[yName].range)) { | ||
coerceRange(yName, 'rangemode', 'fixed'); | ||
} else { | ||
coerceRange(yName, 'rangemode', 'auto'); | ||
} | ||
if(containerIn[yName].range && layoutOut[yName].isValidRange(containerIn[yName].range)) { | ||
coerceRange(yName, 'rangemode', 'fixed'); | ||
} else { | ||
coerceRange(yName, 'rangemode', 'auto'); | ||
} | ||
|
||
layoutOut[yName].cleanRange('rangeslider.' + yName + '.range'); | ||
coerceRange(yName, 'range', layoutOut[yName].rangeslider[yName].range.slice()); | ||
delete layoutOut[yName].rangeslider; | ||
layoutOut[yName].cleanRange('rangeslider.' + yName + '.range'); | ||
coerceRange(yName, 'range', layoutOut[yName].rangeslider[yName].range.slice()); | ||
delete layoutOut[yName].rangeslider; | ||
} | ||
} | ||
|
||
// to map back range slider (auto) range | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit tricky actually - we don't want all y axes, we only want the ones that apply to this x axis. It might be sufficient to look at
subplots.cartesian
, filtering on the x axis ID and taking the y axis IDs (note that you can't do this withsubplotId.indexOf(xId) !== -1
becausex
is a valid ID - you have to do something likesubplotId.substr(0, subplotId.indexOf('y')) === xId
, like here)I say might because I'm not sure what happens with rangesliders now if we have overlaying x axes... that would be very weird and confusing, so I think I'd be OK ignoring the y data for these axes, but we should confirm that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we just use :
layoutOut[yName].anchor === axisIds.name2id(axName)
in thefor
loop ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle you can have a y axis shared across several x axes, or positioned as a free axis, and not anchored to the one with the range slider, so unfortunately I don't think that will work.