Skip to content

Commit 2653067

Browse files
committed
Allow to remove a scaleanchor constraint that is set by default
1 parent e38c18b commit 2653067

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/plots/cartesian/constraints.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function handleOneAxDefaults(axIn, axOut, opts) {
253253
scaleanchor = Lib.coerce(axIn, axOut, {
254254
scaleanchor: {
255255
valType: 'enumerated',
256-
values: linkableAxes
256+
values: linkableAxes.concat([false])
257257
}
258258
}, 'scaleanchor', scaleanchorDflt);
259259
}

src/plots/cartesian/layout_attributes.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,13 @@ module.exports = {
330330
].join(' ')
331331
},
332332
// scaleanchor: not used directly, just put here for reference
333-
// values are any opposite-letter axis id
333+
// values are any opposite-letter axis id, or `false`.
334334
scaleanchor: {
335335
valType: 'enumerated',
336336
values: [
337337
constants.idRegex.x.toString(),
338-
constants.idRegex.y.toString()
338+
constants.idRegex.y.toString(),
339+
false
339340
],
340341
editType: 'plot',
341342
description: [
@@ -353,7 +354,12 @@ module.exports = {
353354
'and the last constraint encountered will be ignored to avoid possible',
354355
'inconsistent constraints via `scaleratio`.',
355356
'Note that setting axes simultaneously in both a `scaleanchor` and a `matches` constraint',
356-
'is currently forbidden.'
357+
'is currently forbidden.',
358+
'Setting `false` allows to remove a default constraint (occasionally,',
359+
'you may need to prevent a default `scaleanchor` constraint from',
360+
'being applied, eg. when having an image trace `yaxis: {scaleanchor: "x"}`',
361+
'is set automatically in order for pixels to be rendered as squares,',
362+
'setting `yaxis: {scaleanchor: false}` allows to remove the constraint).'
357363
].join(' ')
358364
},
359365
scaleratio: {

0 commit comments

Comments
 (0)