8000 Add `tickson: 'boundaries'` for category cartesian axes by etpinard · Pull Request #3275 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Add tickson: 'boundaries' for category cartesian axes #3275

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

Merged
merged 10 commits into from
Nov 29, 2018
Next Next commit
coerce tickson,
... only on `type: 'category'` cartesian axes with
    visible ticks and/or grid lines.
  • Loading branch information
etpinard committed Nov 20, 2018
commit 3a953dbdb3be8995abd79fe6c56888fca1d1f2ea
1 change: 1 addition & 0 deletions src/components/colorbar/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ module.exports = function draw(gd, id) {
letter: 'y',
font: fullLayout.font,
noHover: true,
noTickson: true,
calendar: fullLayout.calendar // not really necessary (yet?)
};

Expand Down
6 changes: 6 additions & 0 deletions src/plots/cartesian/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var setConvert = require('./set_convert');
* outerTicks: boolean, should ticks default to outside?
* showGrid: boolean, should gridlines be shown by default?
* noHover: boolean, this axis doesn't support hover effects?
* noTickson: boolean, this axis doesn't support 'tickson'
* data: the plot data, used to manage categories
* bgColor: the plot background color, to calculate default gridline colors
*/
Expand Down Expand Up @@ -89,5 +90,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,

if(options.automargin) coerce('automargin');

if(!options.noTickson &&
containerOut.type === 'category' && (containerOut.ticks || containerOut.showgrid)) {
coerce('tickson');
}

return containerOut;
};
13 changes: 13 additions & 0 deletions src/plots/cartesian/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,19 @@ module.exports = {
'the axis lines.'
].join(' ')
},
tickson: {
valType: 'enumerated',
values: ['labels', 'boundaries'],
role: 'info',
editType: 'ticks',
description: [
'Determines where ticks and grid lines are drawn with respect to their',
'corresponding tick labels.',
'Only has an effect for axes of `type` *category*.',
'When set to *boundaries*, ticks and grid lines are drawn half a category',
'to the left/bottom of labels.'
].join(' ')
},
mirror: {
valType: 'enumerated',
values: [true, 'ticks', false, 'all', 'allticks'],
Expand Down
1 change: 1 addition & 0 deletions src/plots/gl3d/layout/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
letter: axName[0],
data: options.data,
showGrid: true,
noTickson: true,
bgColor: options.bgColor,
calendar: options.calendar
},
Expand Down
0