Skip to content

Commit

Permalink
fix multicategory label placement for outside tickson:labels
Browse files Browse the repository at this point in the history
- multicategory2 now has the correct divider length
- some multicategory baselines are updated with
  more precise ax._depth, which tweaks the axis title positioning
- multicategory_histograms and multicategory-sorting appear to
  have (very) slightly longer dividers
  • Loading branch information
etpinard committed Sep 4, 2019
1 parent 40f1b24 commit bb127af
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1828,13 +1828,11 @@ axes.drawOne = function(gd, ax, opts) {

if(ax.type === 'multicategory') {
var pad = {x: 2, y: 10}[axLetter];
var sgn = tickSigns[2] * (ax.ticks === 'inside' ? -1 : 1);
var bboxKey = {x: 'height', y: 'width'}[axLetter];

// TODO missing 'ax.ticklen` part when tickson:'labels'
var sgn = {l: -1, t: -1, r: 1, b: 1}[ax.side.charAt(0)];

seq.push(function() {
ax._depth = getLabelLevelBbox()[bboxKey] + pad +
var bboxKey = {x: 'height', y: 'width'}[axLetter];
var standoff = getLabelLevelBbox()[bboxKey] + pad +
(ax._tickAngles[axId + 'tick'] ? ax.tickfont.size * LINE_SPACING : 0);

return axes.drawLabels(gd, ax, {
Expand All @@ -1844,12 +1842,12 @@ axes.drawOne = function(gd, ax, opts) {
repositionOnUpdate: true,
secondary: true,
transFn: transFn,
labelFns: axes.makeLabelFns(ax, mainLinePosition + ax._depth * sgn)
labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * sgn)
});
});

seq.push(function() {
ax._depth += getLabelLevelBbox('tick2')[bboxKey];
ax._depth = sgn * (getLabelLevelBbox('tick2')[ax.side] - mainLinePosition);

return drawDividers(gd, ax, {
vals: dividerVals,
Expand Down
Binary file modified test/image/baselines/multicategory-inside-ticks.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/multicategory-mirror.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/multicategory-sorting.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/multicategory-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/multicategory2.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/multicategory_histograms.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/violin_grouped_horz-multicategory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bb127af

Please sign in to comment.