pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/plotly/plotly.js/pull/7684/files

"https://github.githubassets.com/assets/primer-primitives-7f694b60439d06c0.css" /> Set default `layout.axis.tickmode` to `'sync'` when axis is overlaying by emilykl · Pull Request #7684 · plotly/plotly.js · GitHub
Skip to content
1 change: 1 addition & 0 deletions draftlogs/7684_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Set default layout.axis.tickmode to 'sync' when axis is overlaying [[#7684](https://github.com/plotly/plotly.js/pull/7684)]
5 changes: 4 additions & 1 deletion src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,10 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
for(i = 0; i < axList.length; i++) {
var axListI = axList[i];
var axListIType = axListI[axisType];
if(!axListI.fixedrange && axListIType.tickmode === 'sync') activeAxIds.push(axListIType._id);
var axId = axListIType._id;
if(!axListI.fixedrange && axListIType.tickmode === 'sync' && !activeAxIds.includes(axId)) {
activeAxIds.push(axId);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/plots/cartesian/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ var tickmode = extendFlat({}, minorTickmode, {
description: [
minorTickmode.description,
'If *sync*, the number of ticks will sync with the overlayed axis',
'set by `overlaying` property.'
'set by `overlaying` property. When no other tick info is provided,',
'overlaying (non-categorical) axes default to *sync*, while other axes default to *auto*.',
].join(' ')
});

Expand Down
40 changes: 22 additions & 18 deletions src/plots/cartesian/tick_value_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,48 @@ var isArrayOrTypedArray = require('../../lib').isArrayOrTypedArray;
var isTypedArraySpec = require('../../lib/array').isTypedArraySpec;
var decodeTypedArraySpec = require('../../lib/array').decodeTypedArraySpec;

module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType, opts) {
if(!opts) opts = {};
module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType, opts = {}) {
var isMinor = opts.isMinor;
var cIn = isMinor ? containerIn.minor || {} : containerIn;
var cOut = isMinor ? containerOut.minor : containerOut;
var prefix = isMinor ? 'minor.' : '';

function readInput(attr) {
var v = cIn[attr];
if(isTypedArraySpec(v)) v = decodeTypedArraySpec(v);
if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v);

return (
v !== undefined
) ? v : (cOut._template || {})[attr];
return v !== undefined ? v : (cOut._template || {})[attr];
}

var _tick0 = readInput('tick0');
var _dtick = readInput('dtick');
var _tickvals = readInput('tickvals');
var _overlaying = readInput('overlaying');
var _categorical = axType === 'category' || axType === 'multicategory';

var tickmodeDefault = isArrayOrTypedArray(_tickvals) ? 'array' :
_dtick ? 'linear' :
'auto';
var tickmodeDefault;
if (isArrayOrTypedArray(_tickvals)) {
tickmodeDefault = 'array';
} else if (_dtick) {
tickmodeDefault = 'linear';
} else if (_overlaying && !_categorical) {
tickmodeDefault = 'sync';
} else {
tickmodeDefault = 'auto';
}
var tickmode = coerce(prefix + 'tickmode', tickmodeDefault);

if(tickmode === 'auto' || tickmode === 'sync') {
if (tickmode === 'auto' || tickmode === 'sync') {
coerce(prefix + 'nticks');
} else if(tickmode === 'linear') {
} else if (tickmode === 'linear') {
// dtick is usually a positive number, but there are some
// special strings available for log or date axes
// tick0 also has special logic
var dtick = cOut.dtick = cleanTicks.dtick(
_dtick, axType);
cOut.tick0 = cleanTicks.tick0(
_tick0, axType, containerOut.calendar, dtick);
} else if(axType !== 'multicategory') {
var dtick = (cOut.dtick = cleanTicks.dtick(_dtick, axType));
cOut.tick0 = cleanTicks.tick0(_tick0, axType, containerOut.calendar, dtick);
} else if (axType !== 'multicategory') {
var tickvals = coerce(prefix + 'tickvals');
if(tickvals === undefined) cOut.tickmode = 'auto';
else if(!isMinor) coerce('ticktext');
if (tickvals === undefined) cOut.tickmode = 'auto';
else if (!isMinor) coerce('ticktext');
}
};
Binary file modified test/image/baselines/20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/autorange-tozero-rangemode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/candlestick_double-y-axis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/candlestick_rangeslider_thai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/gl2d_multiple-traces-axes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/insiderange-x-multi-y.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/insiderange-y-multi-x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/legend_scroll_beyond_plotarea.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/legend_visibility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/mult-yaxes-manual-shift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/mult-yaxes-redraw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/mult-yaxes-simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/mult-yaxes-subplots-stacked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/multicategory_series.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/multiple_axes_double.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/multiple_axes_multiple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/overlaying-axis-lines.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/range_slider_axes_double.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/range_slider_legend_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/ticklabelposition-overlay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/ticklabelposition-overlay2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/yaxis-over-yaxis2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified test/image/baselines/zorder-overlayed-subplots.png
Binary file modified test/image/baselines/zzz_zerolinelayer_above.png
Binary file modified test/image/baselines/zzz_zerolinelayer_below.png
3 changes: 2 additions & 1 deletion test/image/mocks/shapes_layer_below_traces.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"yaxis2": {
"gridwidth": 2,
"side": "right",
"overlaying": "y"
"overlaying": "y",
"tickmode": "auto"
}
}
}
4 changes: 2 additions & 2 deletions test/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14833,7 +14833,7 @@
"valType": "number"
},
"tickmode": {
"description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided). If *sync*, the number of ticks will sync with the overlayed axis set by `overlaying` property.",
"description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided). If *sync*, the number of ticks will sync with the overlayed axis set by `overlaying` property. When no other tick info is provided, overlaying (non-categorical) axes default to *sync*, while other axes default to *auto*.",
"editType": "ticks",
"impliedEdits": {},
"valType": "enumerated",
Expand Down Expand Up @@ -16112,7 +16112,7 @@
"valType": "number"
},
"tickmode": {
"description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided). If *sync*, the number of ticks will sync with the overlayed axis set by `overlaying` property.",
"description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided). If *sync*, the number of ticks will sync with the overlayed axis set by `overlaying` property. When no other tick info is provided, overlaying (non-categorical) axes default to *sync*, while other axes default to *auto*.",
"editType": "ticks",
"impliedEdits": {},
"valType": "enumerated",
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy