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 13f848e

Browse filesBrowse files
committed
scalewith -> scaleanchor
1 parent f521227 commit 13f848e
Copy full SHA for 13f848e

File tree

Expand file treeCollapse file tree

5 files changed

+26
-26
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+26
-26
lines changed

‎src/plots/cartesian/constraint_defaults.js

Copy file name to clipboardExpand all lines: src/plots/cartesian/constraint_defaults.js
+18-18Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ var id2name = require('./axis_ids').id2name;
1616
module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, counterAxes, layoutOut) {
1717
var constraintGroups = layoutOut._axisConstraintGroups;
1818

19-
if(!containerIn.scalewith) return;
19+
if(!containerIn.scaleanchor) return;
2020

2121
var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, counterAxes, layoutOut);
2222

23-
var scalewith = Lib.coerce(containerIn, containerOut, {
24-
scalewith: {
23+
var scaleanchor = Lib.coerce(containerIn, containerOut, {
24+
scaleanchor: {
2525
valType: 'enumerated',
2626
values: constraintOpts.linkableAxes
2727
}
28-
}, 'scalewith');
28+
}, 'scaleanchor');
2929

30-
if(scalewith) {
30+
if(scaleanchor) {
3131
var scaleratio = coerce('scaleratio');
3232
// TODO: I suppose I could do attribute.min: Number.MIN_VALUE to avoid zero,
3333
// but that seems hacky. Better way to say "must be a positive number"?
@@ -37,18 +37,18 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co
3737
if(!scaleratio) scaleratio = containerOut.scaleratio = 1;
3838

3939
updateConstraintGroups(constraintGroups, constraintOpts.thisGroup,
40-
containerOut._id, scalewith, scaleratio);
40+
containerOut._id, scaleanchor, scaleratio);
4141
}
42-
else if(counterAxes.indexOf(containerIn.scalewith) !== -1) {
43-
Lib.warn('ignored ' + containerOut._name + '.scalewith: "' +
44-
containerIn.scalewith + '" to avoid an infinite loop ' +
42+
else if(counterAxes.indexOf(containerIn.scaleanchor) !== -1) {
43+
Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' +
44+
containerIn.scaleanchor + '" to avoid an infinite loop ' +
4545
'and possibly inconsistent scaleratios.');
4646
}
4747
};
4848

4949
function getConstraintOpts(constraintGroups, thisID, counterAxes, layoutOut) {
5050
// If this axis is already part of a constraint group, we can't
51-
// scalewith any other axis in that group, or we'd make a loop.
51+
// scaleanchor any other axis in that group, or we'd make a loop.
5252
// Filter counterAxes to enforce this, also matching axis types.
5353

5454
var thisType = layoutOut[id2name(thisID)].type;
@@ -84,10 +84,10 @@ function getConstraintOpts(constraintGroups, thisID, counterAxes, layoutOut) {
8484
*
8585
* thisGroup: the group the current axis is already in
8686
* thisID: the id if the current axis
87-
* scalewith: the id of the axis to scale it with
88-
* scaleratio: the ratio of this axis to the scalewith axis
87+
* scaleanchor: the id of the axis to scale it with
88+
* scaleratio: the ratio of this axis to the scaleanchor axis
8989
*/
90-
function updateConstraintGroups(constraintGroups, thisGroup, thisID, scalewith, scaleratio) {
90+
function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) {
9191
var i, j, groupi, keyj, thisGroupIndex;
9292

9393
if(thisGroup === null) {
@@ -103,11 +103,11 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scalewith,
103103
var thisGroupKeys = Object.keys(thisGroup);
104104

105105
// we know that this axis isn't in any other groups, but we don't know
106-
// about the scalewith axis. If it is, we need to merge the groups.
106+
// about the scaleanchor axis. If it is, we need to merge the groups.
107107
for(i = 0; i < constraintGroups.length; i++) {
108108
groupi = constraintGroups[i];
109-
if(i !== thisGroupIndex && groupi[scalewith]) {
110-
var baseScale = groupi[scalewith];
109+
if(i !== thisGroupIndex && groupi[scaleanchor]) {
110+
var baseScale = groupi[scaleanchor];
111111
for(j = 0; j < thisGroupKeys.length; j++) {
112112
keyj = thisGroupKeys[j];
113113
groupi[keyj] = baseScale * scaleratio * thisGroup[keyj];
@@ -117,12 +117,12 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scalewith,
117117
}
118118
}
119119

120-
// otherwise, we insert the new scalewith axis as the base scale (1)
120+
// otherwise, we insert the new scaleanchor axis as the base scale (1)
121121
// in its group, and scale the rest of the group to it
122122
if(scaleratio !== 1) {
123123
for(j = 0; j < thisGroupKeys.length; j++) {
124124
thisGroup[thisGroupKeys[j]] *= scaleratio;
125125
}
126126
}
127-
thisGroup[scalewith] = 1;
127+
thisGroup[scaleanchor] = 1;
128128
}

‎src/plots/cartesian/layout_attributes.js

Copy file name to clipboardExpand all lines: src/plots/cartesian/layout_attributes.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ module.exports = {
107107
'If true, then zoom is disabled.'
108108
].join(' ')
109109
},
110-
// scalewith: not used directly, just put here for reference
110+
// scaleanchor: not used directly, just put here for reference
111111
// values are any opposite-letter axis id
112-
scalewith: {
112+
scaleanchor: {
113113
valType: 'enumerated',
114114
values: [
115115
constants.idRegex.x.toString(),
@@ -123,9 +123,9 @@ module.exports = {
123123
'Both axes are still zoomable, but when you zoom one, the other will',
124124
'zoom the same amount, keeping a fixed midpoint.',
125125
'Autorange will also expand about the midpoints to satisfy the constraint.',
126-
'You can chain these, ie `yaxis: {scalewith: *x*}, xaxis2: {scalewith: *y*}`',
126+
'You can chain these, ie `yaxis: {scaleanchor: *x*}, xaxis2: {scaleanchor: *y*}`',
127127
'but you can only link axes of the same `type`.',
128-
'Loops (`yaxis: {scalewith: *x*}, xaxis: {scalewith: *y*}` or longer) are redundant',
128+
'Loops (`yaxis: {scaleanchor: *x*}, xaxis: {scaleanchor: *y*}` or longer) are redundant',
129129
'and the last constraint encountered will be ignored to avoid possible',
130130
'inconsistent constraints via `scaleratio`.'
131131
].join(' ')
@@ -136,7 +136,7 @@ module.exports = {
136136
dflt: 1,
137137
role: 'info',
138138
description: [
139-
'If this axis is linked to another by `scalewith`, this determines the pixel',
139+
'If this axis is linked to another by `scaleanchor`, this determines the pixel',
140140
'to unit scale ratio. For example, if this value is 10, then every unit on',
141141
'this axis spans 10 times the number of pixels as a unit on the linked axis.',
142142
'Use this for example to create an elevation profile where the vertical scale',

‎src/plots/cartesian/layout_defaults.js

Copy file name to clipboardExpand all lines: src/plots/cartesian/layout_defaults.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
143143
return out;
144144
}
145145

146-
// sets of axes linked by `scalewith` along with the scaleratios compounded
146+
// sets of axes linked by `scaleanchor` along with the scaleratios compounded
147147
// together, populated in handleConstraintDefaults
148148
layoutOut._axisConstraintGroups = [];
149149

‎test/image/mocks/axes_scalewith.json renamed to ‎test/image/mocks/axes_scaleanchor.json

Copy file name to clipboardExpand all lines: test/image/mocks/axes_scaleanchor.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"height":600,
99
"title": "fixed-ratio axes",
1010
"xaxis": {"nticks": 10, "title": "shared X axis"},
11-
"yaxis": {"scalewith": "x", "domain": [0, 0.45], "title": "1:1"},
12-
"yaxis2": {"scalewith": "x", "scaleratio": 0.2, "domain": [0.55,1], "title": "1:5"},
11+
"yaxis": {"scaleanchor": "x", "domain": [0, 0.45], "title": "1:1"},
12+
"yaxis2": {"scaleanchor": "x", "scaleratio": 0.2, "domain": [0.55,1], "title": "1:5"},
1313
"showlegend": false
1414
}
1515
}

0 commit comments

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