@@ -176,15 +176,14 @@ function draw_venn(sets_venn,div) {
176176 ALL
177177 . select ( 'text.label tspan' ) . text ( d => `${ d . size } genes` ) ;
178178
179- _cur_venn_div . selectAll ( "g" )
179+ const vg = _cur_venn_div . selectAll ( "g" )
180180 . on ( "mouseover" , function ( d , i ) {
181181 // sort all the areas relative to the current item
182182 venn . sortAreas ( _cur_venn_div , d ) ;
183183
184184 // Display a tooltip with the current size
185185 tooltip . transition ( ) . duration ( 1 ) . style ( "opacity" , .9 ) ;
186186
187-
188187 if ( d . sets [ 0 ] === "ALL" && d . sets . length === 1 ) {
189188 tooltip . text ( d . size + ` from ${ totalgenes } genes` ) ;
190189 } else if ( d . sets . includes ( 0 ) && globalFilter [ 0 ] [ "name" ] === keyGenes_rename ) { //include s1's set
@@ -198,6 +197,17 @@ function draw_venn(sets_venn,div) {
198197 selection . select ( "path" )
199198 . style ( "fill-opacity" , d . sets . length === 1 ? .4 : .1 )
200199 . style ( "stroke-opacity" , 1 ) ;
200+ const sets = d . sets . filter ( e => e !== 'ALL' ) ;
201+ if ( d . label === 'ALL' ) {
202+ _cur_venn_div . selectAll ( 'text.label' ) . style ( 'opacity' , 0 ) . filter ( e => e . label === 'ALL' )
203+ . style ( 'opacity' , 1 ) ;
204+
205+ } else {
206+ _cur_venn_div . selectAll ( 'text.label' ) . style ( 'opacity' , 0 ) . filter ( e => e . label && sets . find ( f => f === e . label ) )
207+ . style ( 'opacity' , 1 ) ;
208+ vg . style ( 'opacity' , 0.1 ) . filter ( e => e . label && sets . find ( f => f === e . label ) )
209+ . style ( 'opacity' , 1 ) ;
210+ }
201211 } )
202212
203213 . on ( "mousemove" , function ( ) {
@@ -212,6 +222,8 @@ function draw_venn(sets_venn,div) {
212222 . style ( "fill-opacity" , d . sets . length === 1 ? .25 : .0 )
213223 . style ( "stroke-opacity" , d . sets [ 0 ] === keyGenes_rename && d . sets . length === 1 ? 1 :0 ) ;
214224 selection . select ( "path.selected" ) . style ( "stroke-opacity" , 1 ) ;
225+ _cur_venn_div . selectAll ( 'text.label' ) . style ( 'opacity' , 1 ) ;
226+ vg . style ( 'opacity' , 1 ) ;
215227 } )
216228 . on ( "click" , function ( d ) {
217229 _cur_venn_div . selectAll ( "g path.selected" ) . classed ( 'selected' , false ) . style ( 'stroke' , null )
0 commit comments