@@ -931,6 +931,58 @@ describe('finance charts updates:', function() {
931931 . then ( done ) ;
932932 } ) ;
933933
934+ it ( 'should be able to update ohlc tickwidth' , function ( done ) {
935+ var trace0 = Lib . extendDeep ( { } , mock0 , { type : 'ohlc' } ) ;
936+
937+ function _assert ( msg , exp ) {
938+ var tickLen = gd . calcdata [ 0 ] [ 0 ] . t . tickLen ;
939+ expect ( tickLen )
940+ . toBe ( exp . tickLen , 'tickLen val in calcdata - ' + msg ) ;
941+ var pathd = d3 . select ( gd ) . select ( '.ohlc > path' ) . attr ( 'd' ) ;
942+ expect ( pathd )
943+ . toBe ( exp . pathd , 'path d attr - ' + msg ) ;
944+ }
945+
946+ Plotly . plot ( gd , [ trace0 ] , {
947+ xaxis : { rangeslider : { visible : false } }
948+ } )
949+ . then ( function ( ) {
950+ _assert ( 'auto rng / base tickwidth' , {
951+ tickLen : 0.3 ,
952+ pathd : 'M13.5,137.63H33.75M33.75,75.04V206.53M54,80.3H33.75'
953+ } ) ;
954+ return Plotly . restyle ( gd , 'tickwidth' , 0 ) ;
955+ } )
956+ . then ( function ( ) {
957+ _assert ( 'auto rng / no tickwidth' , {
958+ tickLen : 0 ,
959+ pathd : 'M33.75,137.63H33.75M33.75,75.04V206.53M33.75,80.3H33.75'
960+ } ) ;
961+
962+ return Plotly . update ( gd , {
963+ tickwidth : null
964+ } , {
965+ 'xaxis.range' : [ 0 , 8 ] ,
966+ 'yaxis.range' : [ 30 , 36 ]
967+ } ) ;
968+ } )
969+ . then ( function ( ) {
970+ _assert ( 'set rng / base tickwidth' , {
971+ tickLen : 0.3 ,
972+ pathd : 'M-20.25,134.55H0M0,81V193.5M20.25,85.5H0'
973+ } ) ;
974+ return Plotly . restyle ( gd , 'tickwidth' , 0 ) ;
975+ } )
976+ . then ( function ( ) {
977+ _assert ( 'set rng / no tickwidth' , {
978+ tickLen : 0 ,
979+ pathd : 'M0,134.55H0M0,81V193.5M0,85.5H0'
980+ } ) ;
981+ } )
982+ . catch ( failTest )
983+ . then ( done ) ;
984+ } ) ;
985+
934986} ) ;
935987
936988describe ( 'finance charts *special* handlers:' , function ( ) {
0 commit comments