Skip to content
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

Revise textposition default for bar, histogram and waterfall #5638

Merged
merged 5 commits into from
May 11, 2021
Merged
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: 3 additions & 2 deletions src/traces/bar/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = {
textposition: {
valType: 'enumerated',
values: ['inside', 'outside', 'auto', 'none'],
dflt: 'none',
dflt: 'auto',
arrayOk: true,
editType: 'calc',
description: [
Expand All @@ -86,7 +86,8 @@ module.exports = {
'this one, then the text gets pushed inside.',
'*auto* tries to position `text` inside the bar, but if',
'the bar is too small and no bar is stacked on this one',
'the text is moved outside.'
'the text is moved outside.',
'If *none*, no text appears.'
].join(' ')
},

Expand Down
2 changes: 1 addition & 1 deletion src/traces/funnel/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
}),

text: barAttrs.text,
textposition: extendFlat({}, barAttrs.textposition, {dflt: 'auto'}),
textposition: barAttrs.textposition,
insidetextanchor: extendFlat({}, barAttrs.insidetextanchor, {dflt: 'middle'}),
textangle: extendFlat({}, barAttrs.textangle, {dflt: 0}),
textfont: barAttrs.textfont,
Expand Down
Binary file modified test/image/baselines/histogram-offsetgroups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions test/image/mocks/bar-autotext-log-size-axes.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
"type": "bar",
"x": ["giraffes", "orangutans", "monkeys"],
"y": [20, 14, 1],
"text": ["giraffes", "orangutans", "monkeys"],
"textposition": "auto"
"text": ["giraffes", "orangutans", "monkeys"]
}, {
"type": "bar",
"x": ["giraffes", "orangutans", "monkeys"],
"y": [20, 14, 1],
"text": ["giraffes", "orangutans", "monkeys"],
"textposition": "auto",
"xaxis": "x2",
"yaxis": "y2"
}, {
Expand All @@ -19,7 +17,6 @@
"x": [20, 14, 1],
"text": ["giraffes", "orangutans", "monkeys"],
"orientation": "h",
"textposition": "auto",
"xaxis": "x3",
"yaxis": "y3"
}, {
Expand All @@ -28,7 +25,6 @@
"x": [20, 14, 1],
"text": ["giraffes", "orangutans", "monkeys"],
"orientation": "h",
"textposition": "auto",
"xaxis": "x4",
"yaxis": "y4"
}],
Expand Down
2 changes: 0 additions & 2 deletions test/image/mocks/bar-like_textangle45.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"invisible"
],
"type": "bar",
"textposition": "auto",
"textangle": -45,
"xaxis": "x",
"yaxis": "y"
Expand All @@ -29,7 +28,6 @@
"visible"
],
"type": "bar",
"textposition": "auto",
"textangle": -45,
"xaxis": "x",
"yaxis": "y"
Expand Down
2 changes: 0 additions & 2 deletions test/image/mocks/bar-like_textangle60.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"invisible"
],
"type": "bar",
"textposition": "auto",
"textangle": -60,
"xaxis": "x",
"yaxis": "y"
Expand All @@ -29,7 +28,6 @@
"visible"
],
"type": "bar",
"textposition": "auto",
"textangle": -60,
"xaxis": "x",
"yaxis": "y"
Expand Down
4 changes: 0 additions & 4 deletions test/image/mocks/bar-like_traces_tozero.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"-11",
"+1"
],
"textposition": "auto",
"insidetextanchor": "middle",
"base": 10
},
Expand All @@ -43,7 +42,6 @@
"+11",
"-1"
],
"textposition": "auto",
"insidetextanchor": "middle",
"base": -10
},
Expand All @@ -66,7 +64,6 @@
"-12",
"+1"
],
"textposition": "auto",
"insidetextanchor": "middle",
"base": 10
},
Expand All @@ -90,7 +87,6 @@
"+12",
"-1"
],
"textposition": "auto",
"insidetextanchor": "middle",
"base": -10
}
Expand Down
4 changes: 0 additions & 4 deletions test/image/mocks/bar_display_height_zero.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false
},
Expand All @@ -48,7 +47,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x2",
Expand Down Expand Up @@ -77,7 +75,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x3",
Expand Down Expand Up @@ -106,7 +103,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x4",
Expand Down
8 changes: 0 additions & 8 deletions test/image/mocks/bar_display_height_zero_no_line_width.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
0.75,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false
},
Expand Down Expand Up @@ -55,7 +54,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false
},
Expand All @@ -82,7 +80,6 @@
0.75,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x2",
Expand Down Expand Up @@ -116,7 +113,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x2",
Expand Down Expand Up @@ -146,7 +142,6 @@
0.75,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x3",
Expand Down Expand Up @@ -181,7 +176,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x3",
Expand Down Expand Up @@ -211,7 +205,6 @@
0.75,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x4",
Expand Down Expand Up @@ -246,7 +239,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x4",
Expand Down
8 changes: 0 additions & 8 deletions test/image/mocks/bar_display_height_zero_only_line_width.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false
},
Expand Down Expand Up @@ -60,7 +59,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false
},
Expand Down Expand Up @@ -92,7 +90,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x2",
Expand Down Expand Up @@ -126,7 +123,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x2",
Expand Down Expand Up @@ -161,7 +157,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x3",
Expand Down Expand Up @@ -196,7 +191,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x3",
Expand Down Expand Up @@ -231,7 +225,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x4",
Expand Down Expand Up @@ -266,7 +259,6 @@
null,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x4",
Expand Down
4 changes: 0 additions & 4 deletions test/image/mocks/bar_hide_nulls.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
0.001,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false
},
Expand All @@ -44,7 +43,6 @@
0.001,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x2",
Expand All @@ -71,7 +69,6 @@
0.001,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x3",
Expand All @@ -98,7 +95,6 @@
0.001,
1
],
"textposition": "auto",
"insidetextanchor": "middle",
"cliponaxis": false,
"xaxis": "x4",
Expand Down
1 change: 0 additions & 1 deletion test/image/mocks/display-text_zero-number.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"measure": ["r", "r", "r", "r", "r", "t", "a"],
"text": [null, "", "0", 0, 1, true, false],
"textinfo": "label+text+final",
"textposition": "auto",
"xaxis": "x2",
"yaxis": "y2"
}
Expand Down
1 change: 0 additions & 1 deletion test/image/mocks/mathjax.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"x": [0, 1],
"y": [1.4, 0.1],
"text": ["H1.400 \\pm 0.023H", "H0.100 \\pm 0.002H"],
"textposition": "auto",
"type": "bar",
"name": "$x=\\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}$"
}, {
Expand Down
2 changes: 0 additions & 2 deletions test/image/mocks/uniformtext_bar-like_10_auto.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"invisible"
],
"type": "bar",
"textposition": "auto",
"xaxis": "x",
"yaxis": "y"
},
Expand All @@ -28,7 +27,6 @@
"visible"
],
"type": "bar",
"textposition": "auto",
"xaxis": "x",
"yaxis": "y"
},
Expand Down
2 changes: 0 additions & 2 deletions test/image/mocks/uniformtext_bar-like_8_horizontal.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
],
"type": "bar",
"textangle": 0,
"textposition": "auto",
"xaxis": "x",
"yaxis": "y"
},
Expand All @@ -30,7 +29,6 @@
],
"type": "bar",
"textangle": 0,
"textposition": "auto",
"xaxis": "x",
"yaxis": "y"
},
Expand Down
2 changes: 0 additions & 2 deletions test/image/mocks/uniformtext_bar-like_8_textangle.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"invisible"
],
"type": "bar",
"textposition": "auto",
"textangle": -90,
"xaxis": "x",
"yaxis": "y"
Expand All @@ -29,7 +28,6 @@
"visible"
],
"type": "bar",
"textposition": "auto",
"textangle": -90,
"xaxis": "x",
"yaxis": "y"
Expand Down
2 changes: 0 additions & 2 deletions test/image/mocks/uniformtext_bar-like_8_textangle45.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"invisible"
],
"type": "bar",
"textposition": "auto",
"textangle": -45,
"xaxis": "x",
"yaxis": "y"
Expand All @@ -29,7 +28,6 @@
"visible"
],
"type": "bar",
"textposition": "auto",
"textangle": -45,
"xaxis": "x",
"yaxis": "y"
Expand Down
Loading