Skip to content

Commit

Permalink
add four failing axis automargin mocks
Browse files Browse the repository at this point in the history
- two showing problems with `ax.mirror`
- one showing problems with multiline axis titles
- one showing with long tilted labels + rangeslider

... added with 1.49.4 failing baselines
  • Loading branch information
etpinard committed Sep 4, 2019
1 parent 2a9bbee commit d54ec94
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1965,6 +1965,7 @@ axes.drawOne = function(gd, ax, opts) {
push[s] += offset;
}

// TODO won't work for multi-line titles !!
if(ax.title.text !== fullLayout._dfltTitle[axLetter]) {
push[s] += ax.title.font.size;
}
Expand Down
Binary file added test/image/baselines/automargin-mirror-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions test/image/mocks/automargin-mirror-all.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"data": [
{
"x": [1, 2, 3],
"y": [4, 5, 6]
},
{
"x": [20, 30, 40],
"y": [50, 60, 70],
"xaxis": "x2",
"yaxis": "y2"
}
],
"layout": {
"showlegend": false,
"grid": {
"rows": 1,
"columns": 2,
"pattern": "independent"
},
"xaxis": {
"automargin": true,
"ticks": "outside",
"showline": true, "linewidth": 5,
"mirror": "all"
},
"xaxis2": {
"automargin": true,
"ticks": "outside",
"showline": true,
"mirror": "all"
},
"yaxis": {
"automargin": true,
"ticks": "outside",
"showline": true,
"zeroline": false,
"mirror": "all"
},
"yaxis2": {
"automargin": true,
"ticks": "outside",
"showline": true, "linewidth": 10,
"zeroline": false,
"mirror": "all"
},
"margin": {"l": 0, "b": 0, "t": 0, "r": 0},
"width": 500,
"height": 400
}
}
60 changes: 60 additions & 0 deletions test/image/mocks/automargin-mirror-allticks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"data": [
{
"x": [1, 2, 3],
"y": [4, 5, 6]
},
{
"x": [20, 30, 40],
"y": [50, 60, 70],
"xaxis": "x2"
},
{
"x": [1, 2, 3],
"y": [4, 5, 6],
"yaxis": "y2"
},
{
"x": [20, 30, 40],
"y": [50, 60, 70],
"xaxis": "x2",
"yaxis": "y2"
}
],
"layout": {
"showlegend": false,
"grid": {
"rows": 2,
"columns": 2
},
"xaxis": {
"automargin": true,
"ticks": "outside",
"showline": true,
"mirror": "all"
},
"xaxis2": {
"automargin": true,
"ticks": "outside", "ticklen": 10,
"showline": true,
"mirror": "allticks"
},
"yaxis": {
"automargin": true,
"ticks": "outside",
"showline": true,
"zeroline": false,
"mirror": "all"
},
"yaxis2": {
"automargin": true,
"ticks": "outside", "ticklen": 5,
"showline": true, "linewidth": 5,
"zeroline": false,
"mirror": "allticks"
},
"margin": {"l": 0, "b": 0, "t": 0, "r": 0},
"width": 500,
"height": 400
}
}
27 changes: 27 additions & 0 deletions test/image/mocks/automargin-multiline-titles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"data": [
{
"y": [1, 2, 1]
}
],
"layout": {
"xaxis": {
"automargin": true,
"nticks": 3,
"tickfont": {"size": 30},
"title": {"text": "Hello<br>Bonjour"},
"zeroline": false
},
"yaxis": {
"automargin": true,
"title": {
"text": "Hello<br>Bonjour<br>Hola",
"font": {"size": 32}
},
"ticklen": 20
},
"width": 400,
"height": 400,
"margin": {"l": 0, "t": 0, "r": 0, "b": 0}
}
}
24 changes: 24 additions & 0 deletions test/image/mocks/automargin-rangeslider-and-sidepush.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"data": [
{
"x": ["a", "b", "c", "d", "long category", "another even longer", "the longest one yet!!!!!!"],
"y": [0, 10, 20, 30, 40, 50, 60]
}
],
"layout": {
"xaxis": {
"title": {
"text": "Bottom X Axis<br><i>2nd line</i>",
"font": {"size": 14}
},
"rangeslider": { "visible": true },
"automargin": true
},
"yaxis": {
"automargin": true
},
"width": 400,
"height": 400,
"margin": {"l": 0, "t": 0, "b": 0, "r": 0}
}
}

0 comments on commit d54ec94

Please sign in to comment.