Skip to content

Commit b7bfc97

Browse files
committed
test: bar texts
* bar_test.js: Test `textposition`. * bar_test.js: Test that `textposition` can also be restyled. * bar_test.js: Test whether outside bars are correctly identified when `barnorm: 'fraction'`. * bar_attrs_relative: Updated to test the bar text functionality. * bar_attrs_group_norm: Updated to test the bar text functionality. * bar_attrs_relative: Reduced font size of text "Three" to ensure the baseline image also fits the text inside the bar. * bar_attrs_group_norm: Exercise functionality to rotate bar texts. * bar_attrs_group_norm: Use "50%" as bar texts to ensure the bounding box width is larger than its height (unfortunately, this wasn't case when the baseline images were generated using "0.5", because the height of the bounding box includes some white space).
1 parent b41f3cd commit b7bfc97

File tree

5 files changed

+409
-9
lines changed

5 files changed

+409
-9
lines changed
4.14 KB
Loading
3.99 KB
Loading

test/image/mocks/bar_attrs_group_norm.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"data":[
33
{
4+
"text":"50%",
5+
"textposition":"inside",
6+
"outsidetextfont": {"size":32},
47
"base":[100,40,25,10],
58
"x":[-50,10,25,40],
69
"type":"bar"
710
}, {
11+
"text":"50%",
12+
"textposition":"outside",
813
"base":[0,60,75,90],
914
"x":[50,-10,-25,-40],
1015
"type":"bar"

test/image/mocks/bar_attrs_relative.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,37 @@
22
"data":[
33
{
44
"width":[1,0.8,0.6,0.4],
5+
"text":[1,2,3333333333,4],
6+
"textposition":"outside",
57
"y":[1,2,3,4],
68
"x":[1,2,3,4],
79
"type":"bar"
810
}, {
911
"width":[0.4,0.6,0.8,1],
12+
"text":["Three",2,"inside text",0],
13+
"textposition":"auto",
14+
"textfont":{"size":[10]},
1015
"y":[3,2,1,0],
1116
"x":[1,2,3,4],
1217
"type":"bar"
1318
}, {
1419
"width":1,
20+
"text":[-1,-3,-2,-4],
21+
"textposition":"inside",
1522
"y":[-1,-3,-2,-4],
1623
"x":[1,2,3,4],
1724
"type":"bar"
1825
}, {
19-
"y":[0,-1,-3,-2],
26+
"text":[0,"outside text",-3,-2],
27+
"textposition":"auto",
28+
"y":[0,-0.25,-3,-2],
2029
"x":[1,2,3,4],
2130
"type":"bar"
2231
}
2332
],
2433
"layout":{
2534
"xaxis": {"showgrid":true},
35+
"yaxis": {"range":[-6,6]},
2636
"height":400,
2737
"width":400,
2838
"barmode":"relative",

0 commit comments

Comments
 (0)