Skip to content

Add "tickpadding" property to control distance between ticks when tickmode is auto #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
1 change: 0 additions & 1 deletion src/components/colorbar/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ module.exports = {
showticklabels: axesAttrs.showticklabels,
tickfont: axesAttrs.tickfont,
tickangle: axesAttrs.tickangle,
tickpadding: axesAttrs.tickpadding,
tickformat: axesAttrs.tickformat,
tickprefix: axesAttrs.tickprefix,
showtickprefix: axesAttrs.showtickprefix,
Expand Down
6 changes: 5 additions & 1 deletion src/components/colorbar/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var Lib = require('../../lib');
var handleTickValueDefaults = require('../../plots/cartesian/tick_value_defaults');
var handleTickMarkDefaults = require('../../plots/cartesian/tick_mark_defaults');
var handleTickLabelDefaults = require('../../plots/cartesian/tick_label_defaults');
var cartesianAxesAttrs = require('../../plots/cartesian/layout_attributes');

var attributes = require('./attributes');

Expand All @@ -21,8 +22,11 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
var colorbarOut = containerOut.colorbar = {},
colorbarIn = containerIn.colorbar || {};

//colorbar doesn't currently implement tickpadding property, but it is a required attribute of a cartesian axis
var cartesianAttributes = Lib.extendFlat({}, attributes, { tickpadding: cartesianAxesAttrs.tickpadding });

function coerce(attr, dflt) {
return Lib.coerce(colorbarIn, colorbarOut, attributes, attr, dflt);
return Lib.coerce(colorbarIn, colorbarOut, cartesianAttributes, attr, dflt);
}

var thicknessmode = coerce('thicknessmode');
Expand Down
1 change: 0 additions & 1 deletion src/plots/gl3d/layout/axis_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ module.exports = {
showticklabels: axesAttrs.showticklabels,
tickfont: axesAttrs.tickfont,
tickangle: axesAttrs.tickangle,
tickpadding: axesAttrs.tickpadding,
tickprefix: axesAttrs.tickprefix,
showtickprefix: axesAttrs.showtickprefix,
ticksuffix: axesAttrs.ticksuffix,
Expand Down
8 changes: 5 additions & 3 deletions src/plots/gl3d/layout/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var Lib = require('../../../lib');

var layoutAttributes = require('./axis_attributes');
var handleAxisDefaults = require('../../cartesian/axis_defaults');
var cartesianAxesAttrs = require('../../cartesian/layout_attributes');

var axesNames = ['xaxis', 'yaxis', 'zaxis'];
var noop = function() {};
Expand All @@ -25,8 +26,11 @@ var gridLightness = 100 * (204 - 0x44) / (255 - 0x44);
module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
var containerIn, containerOut;

//gl3d doesn't currently implement tickpadding property, but it is a required attribute of a cartesian axis
var cartesianLayoutAttributes = Lib.extendFlat({}, layoutAttributes, { tickpadding: cartesianAxesAttrs.tickpadding });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, exactly. Nicely done.


function coerce(attr, dflt) {
return Lib.coerce(containerIn, containerOut, layoutAttributes, attr, dflt);
return Lib.coerce(containerIn, containerOut, cartesianLayoutAttributes, attr, dflt);
}

for(var j = 0; j < axesNames.length; j++) {
Expand All @@ -49,8 +53,6 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
bgColor: options.bgColor
});

delete containerOut.tickpadding; //gl3d doesn't currently implement tickpadding property

coerce('gridcolor', colorMix(containerOut.color, options.bgColor, gridLightness).toRgbString());
coerce('title', axName[0]); // shouldn't this be on-par with 2D?

Expand Down