44description: A map/visualization of the ML4Code papers.
55---
66< h2 > 2D Map of Papers</ h2 >
7- Each dot represents one paper in this survey. Hover your mouse over each point to look
8- at the details. Click on a point to go to the paper information page.
7+ < p > Each dot represents one paper in this survey. Hover your mouse over each point to look
8+ at the details. Click on a point to go to the paper information page.</ p >
9+ < div style ="text-align: right; "> < label > Search </ label > < input type ="text " spellcheck ="false " id ="filtermap "/> </ div >
910< div id ="paperviz "> </ div >
1011
1112Please consider < a href ="/contributing.html "> contributing</ a > by updating
@@ -69,11 +70,6 @@ <h2>2D Map of Papers</h2>
6970 . html ( "<p>" + d . title + " " + tags + "</p>" )
7071 . style ( "left" , ( d3 . mouse ( this ) [ 0 ] + 30 ) + "px" )
7172 . style ( "top" , ( d3 . mouse ( this ) [ 1 ] ) + "px" ) ;
72- d3 . selectAll ( "circle" ) . filter ( dd => dd . key == d . key ) . style ( "fill" , "#ff0000" ) ;
73- }
74-
75- var mouseleave = function ( d ) {
76- d3 . selectAll ( "circle" ) . filter ( dd => dd . key == d . key ) . style ( "fill" , "#69b3a2" ) ;
7773 }
7874
7975 var click_link = function ( d ) {
@@ -92,10 +88,23 @@ <h2>2D Map of Papers</h2>
9288 . style ( "fill" , "#69b3a2" )
9389 . style ( "opacity" , 0.4 )
9490 . style ( "stroke" , "white" )
95- . on ( "mouseover" , mouseover )
96- . on ( "mousemove" , mousemove )
97- . on ( "mouseleave" , mouseleave )
98- . on ( "click" , click_link )
91+ . on ( "mouseover" , mouseover )
92+ . on ( "mousemove" , mousemove )
93+ . on ( "click" , click_link ) ;
94+
95+ var isMatch = function ( d , searchTerm ) {
96+ if ( searchTerm . length < 3 ) return false ;
97+ var allText = ( d . title + " " + d . abstract + " " + d . tags . join ( " " ) ) . toLocaleLowerCase ( ) ;
98+ return allText . indexOf ( searchTerm ) != - 1 ;
99+ }
100+
101+ $ ( "#filtermap" ) . keyup ( function ( e ) {
102+ var searchTerm = $ ( "#filtermap" ) . val ( ) . toLocaleLowerCase ( ) ;
103+ var allPoints = d3 . selectAll ( "circle" ) ;
104+ // TODO: This seems quite inefficient...
105+ allPoints . filter ( dd => ! isMatch ( dd , searchTerm ) ) . style ( "fill" , "#69b3a2" ) ;
106+ allPoints . filter ( dd => isMatch ( dd , searchTerm ) ) . style ( "fill" , "#aa0000" ) ;
107+ } ) ;
99108
100109} ) ;
101110</ script >
0 commit comments