@@ -1741,9 +1741,9 @@ describe('funnelarea uniformtext', function() {
1741
1741
var pos0 = transform . indexOf ( 'scale(' ) ;
1742
1742
var scale = 1 ;
1743
1743
if ( pos0 !== - 1 ) {
1744
- pos0 += 'scale' . length ;
1744
+ pos0 += 'scale( ' . length ;
1745
1745
var pos1 = transform . indexOf ( ')' , pos0 ) ;
1746
- scale = + ( transform . substring ( pos0 + 1 , pos1 - 1 ) ) ;
1746
+ scale = + ( transform . substring ( pos0 , pos1 ) ) ;
1747
1747
}
1748
1748
1749
1749
expect ( opts . scales [ i ] ) . toBeCloseTo ( scale , 1 , 'scale for element ' + i , msg ) ;
@@ -1755,6 +1755,7 @@ describe('funnelarea uniformtext', function() {
1755
1755
var fig = {
1756
1756
data : [ {
1757
1757
type : 'funnelarea' ,
1758
+ baseratio : 1 ,
1758
1759
labels : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ,
1759
1760
values : [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ] ,
1760
1761
sort : false ,
@@ -1768,64 +1769,64 @@ describe('funnelarea uniformtext', function() {
1768
1769
'.' ,
1769
1770
'|' ,
1770
1771
'=' ,
1771
- '$ ' ,
1772
- 'long lablel '
1772
+ 'longest word in German ' ,
1773
+ 'Rindfleischetikettierungsueberwachungsaufgabenuebertragungsgesetz '
1773
1774
] ,
1774
1775
1775
1776
textinfo : 'text' ,
1776
1777
textangle : 0 ,
1777
1778
showlegend : false
1778
1779
} ] ,
1779
1780
layout : {
1780
- width : 350 ,
1781
- height : 350
1781
+ width : 450 ,
1782
+ height : 450
1782
1783
}
1783
1784
} ;
1784
1785
1785
1786
Plotly . plot ( gd , fig )
1786
1787
. then ( assertTextSizes ( 'without uniformtext' , {
1787
1788
fontsizes : [ 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 ] ,
1788
- scales : [ 0.40 , 1 , 0.62 , 0.70 , 0.82 , 0.98 , 1 , 0.91 ] ,
1789
+ scales : [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0.69 ] ,
1789
1790
} ) )
1790
1791
. then ( function ( ) {
1791
1792
fig . layout . uniformtext = { mode : 'hide' } ; // default with minsize=0
1792
1793
return Plotly . react ( gd , fig ) ;
1793
1794
} )
1794
1795
. then ( assertTextSizes ( 'using mode: "hide"' , {
1795
1796
fontsizes : [ 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 ] ,
1796
- scales : [ 0.4 , 0.4 , 0.4 , 0.4 , 0.4 , 0.4 , 0.4 , 0.4 ] ,
1797
+ scales : [ 0.69 , 0.69 , 0.69 , 0.69 , 0.69 , 0.69 , 0.69 , 0.69 ] ,
1797
1798
} ) )
1798
1799
. then ( function ( ) {
1799
1800
fig . layout . uniformtext . minsize = 9 ; // set a minsize less than trace font size
1800
1801
return Plotly . react ( gd , fig ) ;
1801
1802
} )
1802
1803
. then ( assertTextSizes ( 'using minsize: 9' , {
1803
1804
fontsizes : [ 12 , 12 , 12 , 12 , 12 , 12 , 12 , 12 ] ,
1804
- scales : [ 0 , 0.4 , 0 , 0 , 0.4 , 0.4 , 0.4 , 0.4 ] ,
1805
+ scales : [ 0.69 , 0.69 , 0.69 , 0.69 , 0.69 , 0.69 , 0.69 , 0 ] ,
1805
1806
} ) )
1806
1807
. then ( function ( ) {
1807
1808
fig . layout . uniformtext . minsize = 32 ; // set a minsize greater than trace font size
1808
1809
return Plotly . react ( gd , fig ) ;
1809
1810
} )
1810
1811
. then ( assertTextSizes ( 'using minsize: 32' , {
1811
1812
fontsizes : [ 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 ] ,
1812
- scales : [ 0 , 0.15 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
1813
+ scales : [ 0 , 0.26 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
1813
1814
} ) )
1814
1815
. then ( function ( ) {
1815
- fig . layout . uniformtext . minsize = 16 ; // set a minsize greater than trace font size
1816
+ fig . layout . uniformtext . minsize = 13 ; // set a minsize greater than trace font size
1816
1817
return Plotly . react ( gd , fig ) ;
1817
1818
} )
1818
- . then ( assertTextSizes ( 'using minsize: 16 ' , {
1819
- fontsizes : [ 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 ] ,
1820
- scales : [ 0 , 0.3 , 0 , 0 , 0 , 0 , 0.3 , 0 ] ,
1819
+ . then ( assertTextSizes ( 'using minsize: 13 ' , {
1820
+ fontsizes : [ 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 ] ,
1821
+ scales : [ 0.64 , 0.64 , 0.64 , 0.64 , 0.64 , 0.64 , 0.64 , 0 ] ,
1821
1822
} ) )
1822
1823
. then ( function ( ) {
1823
1824
fig . layout . uniformtext . mode = 'show' ;
1824
1825
return Plotly . react ( gd , fig ) ;
1825
1826
} )
1826
1827
. then ( assertTextSizes ( 'using mode: "show"' , {
1827
- fontsizes : [ 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 ] ,
1828
- scales : [ 0.3 , 0.3 , 0.3 , 0.3 , 0.3 , 0.3 , 0.3 , 0.3 ] ,
1828
+ fontsizes : [ 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 ] ,
1829
+ scales : [ 0.64 , 0.64 , 0.64 , 0.64 , 0.64 , 0.64 , 0.64 , 0.64 ] ,
1829
1830
} ) )
1830
1831
. catch ( failTest )
1831
1832
. then ( done ) ;
0 commit comments