@@ -773,4 +773,49 @@ describe('Test select box and lasso per trace:', function() {
773773 . catch ( fail )
774774 . then ( done ) ;
775775 } ) ;
776+
777+ it ( 'should work for histogram traces' , function ( done ) {
778+ var assertPoints = makeAssertPoints ( [ 'curveNumber' , 'x' , 'y' ] ) ;
779+ var assertRanges = makeAssertRanges ( ) ;
780+ var assertLassoPoints = makeAssertLassoPoints ( ) ;
781+
782+ var fig = Lib . extendDeep ( { } , require ( '@mocks/hist_grouped' ) ) ;
783+ fig . layout . dragmode = 'lasso' ;
784+ fig . layout . width = 600 ;
785+ fig . layout . height = 500 ;
786+
787+ Plotly . plot ( gd , fig )
788+ . then ( function ( ) {
789+ return _run (
790+ [ [ 200 , 200 ] , [ 400 , 200 ] , [ 400 , 350 ] , [ 200 , 350 ] , [ 200 , 200 ] ] ,
791+ function ( ) {
792+ assertPoints ( [
793+ [ 0 , 1.8 , 2 ] , [ 1 , 2.2 , 1 ] , [ 1 , 3.2 , 1 ]
794+ ] ) ;
795+ assertLassoPoints ( [
796+ [ 1.66 , 3.59 , 3.59 , 1.66 , 1.66 ] ,
797+ [ 2.17 , 2.17 , 0.69 , 0.69 , 2.17 ]
798+ ] ) ;
799+ } ,
800+ null , LASSOEVENTS , 'histogram lasso'
801+ ) ;
802+ } )
803+ . then ( function ( ) {
804+ return Plotly . relayout ( gd , 'dragmode' , 'select' ) ;
805+ } )
806+ . then ( function ( ) {
807+ return _run (
808+ [ [ 200 , 200 ] , [ 400 , 350 ] ] ,
809+ function ( ) {
810+ assertPoints ( [
811+ [ 0 , 1.8 , 2 ] , [ 1 , 2.2 , 1 ] , [ 1 , 3.2 , 1 ]
812+ ] ) ;
813+ assertRanges ( [ [ 1.66 , 3.59 ] , [ 0.69 , 2.17 ] ] ) ;
814+ } ,
815+ null , BOXEVENTS , 'bar select'
816+ ) ;
817+ } )
818+ . catch ( fail )
819+ . then ( done ) ;
820+ } ) ;
776821} ) ;
0 commit comments