@@ -78,6 +78,7 @@ define( ["qlik", "text!./codewander-plotlyScatterPlotPlayer.ng.html", "css!./cod
7878 maxBubbleSize :"50"
7979 }
8080 var self = this ;
81+ var qElemNumber = [ ] ;
8182 var min_x = 0 ;
8283 var max_x = 0 ;
8384 var min_y = 0 ;
@@ -101,6 +102,7 @@ define( ["qlik", "text!./codewander-plotlyScatterPlotPlayer.ng.html", "css!./cod
101102 self . $scope . lastrow = rownum ;
102103 dataMatrix . push ( row ) ;
103104 } ) ;
105+
104106 var data = convert ( dataMatrix ) ;
105107 render ( data ) ;
106108 //needed for export
@@ -119,6 +121,7 @@ define( ["qlik", "text!./codewander-plotlyScatterPlotPlayer.ng.html", "css!./cod
119121 self . paint ( layout ) ;
120122 } ) ;
121123 }
124+
122125
123126 function convert ( Matrix )
124127 {
@@ -127,6 +130,10 @@ define( ["qlik", "text!./codewander-plotlyScatterPlotPlayer.ng.html", "css!./cod
127130 data [ index ] = { } ;
128131 $ . each ( cols , function ( col_index , col ) {
129132 data [ index ] [ col ] = col_index <= dimensions_count - 1 ? item [ col_index ] . qText : item [ col_index ] . qNum ;
133+ if ( col_index <= dimensions_count - 1 ) {
134+ if ( qElemNumber [ col_index ] == null ) qElemNumber [ col_index ] = { } ;
135+ qElemNumber [ col_index ] [ item [ col_index ] . qText ] = item [ col_index ] . qElemNumber ;
136+ }
130137 } )
131138 } )
132139 return data ;
@@ -308,6 +315,16 @@ define( ["qlik", "text!./codewander-plotlyScatterPlotPlayer.ng.html", "css!./cod
308315 frames : frames ,
309316 } ) ;
310317 }
318+
319+ document . getElementById ( 'myDiv' ) . on ( 'plotly_click' , function ( e ) {
320+ var pts = '' ;
321+ var FirstDimVal = e . points [ 0 ] . data . name ;
322+ var SecondDimVal = e . points [ 0 ] . text ;
323+ self . $scope . makeSelection ( qElemNumber [ 1 ] [ FirstDimVal ] , qElemNumber [ 2 ] [ SecondDimVal ] ) ;
324+
325+
326+ } ) ;
327+
311328
312329 //Plotly Code Ends
313330
@@ -327,6 +344,11 @@ define( ["qlik", "text!./codewander-plotlyScatterPlotPlayer.ng.html", "css!./cod
327344 $scope . lastrow = 0 ;
328345
329346 $scope . selections = [ ] ;
347+ $scope . makeSelection = function ( first , second ) {
348+ this . backendApi . selectValues ( 1 , [ first ] , true ) ;
349+ this . backendApi . selectValues ( 2 , [ second ] , true ) ;
350+
351+ }
330352
331353 $scope . sel = function ( $event ) {
332354 if ( $event . currentTarget . hasAttribute ( "data-row" ) ) {
0 commit comments