Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.indexOf(axId) === -1) {
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,',
'overlyaing (non-categorical) axes default to *sync*, while other axes default to *auto*.',
].join(' ')
});

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

module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType, opts) {
if(!opts) opts = {};
if (!opts) 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.
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.
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.
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.
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.
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.
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.
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.
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.
Binary file modified test/image/baselines/map_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_angles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_bubbles-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_bubbles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_carto-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_carto-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_choropleth-multiple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_choropleth-raw-geojson.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_connectgaps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_density-multiple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_density-multiple_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_density0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_geojson-attributes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_layers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/map_symbol-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Binary file modified test/image/baselines/mult-yaxes-redraw.png
Binary file modified test/image/baselines/mult-yaxes-simple.png
Binary file modified test/image/baselines/mult-yaxes-subplots-stacked.png
Binary file modified test/image/baselines/multicategory_series.png
Binary file modified test/image/baselines/multiple_axes_double.png
Binary file modified test/image/baselines/multiple_axes_multiple.png
Binary file modified test/image/baselines/overlaying-axis-lines.png
Binary file modified test/image/baselines/range_slider_axes_double.png
Binary file modified test/image/baselines/range_slider_legend_left.png
Binary file modified test/image/baselines/ticklabelposition-overlay.png
Binary file modified test/image/baselines/ticklabelposition-overlay2.png
Binary file modified test/image/baselines/yaxis-over-yaxis2.png
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, overlyaing (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, overlyaing (non-categorical) axes default to *sync*, while other axes default to *auto*.",
"editType": "ticks",
"impliedEdits": {},
"valType": "enumerated",
Expand Down