Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 73560f6

Browse filesBrowse files
committed
Merge branch 'master' into rangeslider-allow-zoom-on-oppaxis
2 parents 23c8401 + 2ff1c85 commit 73560f6
Copy full SHA for 73560f6
Expand file treeCollapse file tree

25 files changed

+478
-197
lines changed

‎package-lock.json

Copy file name to clipboardExpand all lines: package-lock.json
+135Lines changed: 135 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Copy file name to clipboardExpand all lines: package.json
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
},
115115
"devDependencies": {
116116
"brfs": "^1.4.4",
117+
"browser-pack-flat": "^3.0.8",
117118
"browserify": "^15.2.0",
118119
"browserify-transform-tools": "^1.7.0",
119120
"check-node-version": "^3.2.0",
@@ -148,6 +149,7 @@
148149
"prettysize": "1.1.0",
149150
"read-last-lines": "^1.1.0",
150151
"requirejs": "^2.3.1",
152+
"run-series": "^1.1.4",
151153
"through2": "^2.0.3",
152154
"true-case-path": "^1.0.2",
153155
"watchify": "^3.10.0",

‎src/components/rangeslider/draw.js

Copy file name to clipboardExpand all lines: src/components/rangeslider/draw.js
+29-9Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var Plots = require('../../plots/plots');
1616
var Lib = require('../../lib');
1717
var Drawing = require('../drawing');
1818
var Color = require('../color');
19+
var Titles = require('../titles');
1920

2021
var Cartesian = require('../../plots/cartesian');
2122
var Axes = require('../../plots/cartesian/axes');
@@ -97,11 +98,17 @@ module.exports = function(gd) {
9798

9899
// update range slider dimensions
99100

100-
var margin = fullLayout.margin,
101-
graphSize = fullLayout._size,
102-
domain = axisOpts.domain,
103-
oppDomain = oppAxisOpts.domain,
104-
tickHeight = (axisOpts._boundingBox || {}).height || 0;
101+
var margin = fullLayout.margin;
102+
var graphSize = fullLayout._size;
103+
var domain = axisOpts.domain;
104+
var tickHeight = (axisOpts._boundingBox || {}).height || 0;
105+
106+
var oppBottom = Infinity;
107+
var subplotData = Axes.getSubplots(gd, axisOpts);
108+
for(var i = 0; i < subplotData.length; i++) {
109+
var oppAxis = Axes.getFromId(gd, subplotData[i].substr(subplotData[i].indexOf('y')));
110+
oppBottom = Math.min(oppBottom, oppAxis.domain[0]);
111+
}
105112

106113
opts._id = constants.name + axisOpts._id;
107114
opts._clipId = opts._id + '-' + fullLayout._uid;
@@ -113,7 +120,7 @@ module.exports = function(gd) {
113120
var x = Math.round(margin.l + (graphSize.w * domain[0]));
114121

115122
var y = Math.round(
116-
margin.t + graphSize.h * (1 - oppDomain[0]) +
123+
graphSize.t + graphSize.h * (1 - oppBottom) +
117124
tickHeight +
118125
opts._offsetShift + constants.extraPad
119126
);
@@ -162,18 +169,31 @@ module.exports = function(gd) {
162169
// update current range
163170
setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRangeOpts);
164171

165-
// update margins
172+
// title goes next to range slider instead of tick labels, so
173+
// just take it over and draw it from here
174+
if(axisOpts.side === 'bottom') {
175+
Titles.draw(gd, axisOpts._id + 'title', {
176+
propContainer: axisOpts,
177+
propName: axisOpts._name + '.title',
178+
placeholder: fullLayout._dfltTitle.x,
179+
attributes: {
180+
x: axisOpts._offset + axisOpts._length / 2,
181+
y: y + opts._height + opts._offsetShift + 10 + 1.5 * axisOpts.titlefont.size,
182+
'text-anchor': 'middle'
183+
}
184+
});
185+
}
166186

187+
// update margins
167188
Plots.autoMargin(gd, opts._id, {
168189
x: domain[0],
169-
y: oppDomain[0],
190+
y: oppBottom,
170191
l: 0,
171192
r: 0,
172193
t: 0,
173194
b: opts._height + margin.b + tickHeight,
174195
pad: constants.extraPad + opts._offsetShift * 2
175196
});
176-
177197
});
178198
};
179199

‎src/components/titles/index.js

Copy file name to clipboardExpand all lines: src/components/titles/index.js
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ var Color = require('../color');
2020
var svgTextUtils = require('../../lib/svg_text_utils');
2121
var interactConstants = require('../../constants/interactions');
2222

23-
var Titles = module.exports = {};
23+
module.exports = {
24+
draw: draw
25+
};
2426

2527
var numStripRE = / [XY][0-9]* /;
2628

@@ -54,7 +56,7 @@ var numStripRE = / [XY][0-9]* /;
5456
*
5557
* @return {selection} d3 selection of title container group
5658
*/
57-
Titles.draw = function(gd, titleClass, options) {
59+
function draw(gd, titleClass, options) {
5860
var cont = options.propContainer;
5961
var prop = options.propName;
6062
var placeholder = options.placeholder;
@@ -255,4 +257,4 @@ Titles.draw = function(gd, titleClass, options) {
255257
el.classed('js-placeholder', isplaceholder);
256258

257259
return group;
258-
};
260+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.