@@ -224,8 +224,11 @@ const TreeLayout = (function() {
224224 let nodeSVG = this . g . selectAll ( '.node' )
225225 . data ( nodes , d => d . node ) ;
226226
227+ let edgeLabel = this . g . selectAll ( '.edgeLabel' )
228+ . data ( links . filter ( l => l . source . node instanceof Link ) , d => d . source . node ) ;
229+
227230 let edgeSVG = this . g . selectAll ( '.edge' )
228- . data ( links , d => d . parent ) ;
231+ . data ( links , d => d . source . node ) ;
229232
230233 //layout constants
231234 const rh = 50 ; // row height
@@ -247,6 +250,7 @@ const TreeLayout = (function() {
247250 edgeSVG . enter ( ) . append ( 'path' )
248251 . attr ( 'class' , 'edge' )
249252 . attr ( 'stroke' , 'grey' )
253+ . attr ( 'stroke-dasharray' , d => d . source . node instanceof Word ? [ 2 , 2 ] : null )
250254 . attr ( 'stroke-width' , '1px' )
251255 . attr ( 'fill' , 'none' )
252256 . merge ( edgeSVG )
@@ -272,7 +276,18 @@ const TreeLayout = (function() {
272276 d . target . offset , d . target . depth * rh - 15
273277 ] ;
274278 }
275- } )
279+ } ) ;
280+
281+ edgeLabel . exit ( ) . remove ( ) ;
282+ edgeLabel . enter ( ) . append ( 'text' )
283+ . attr ( 'text-anchor' , 'middle' )
284+ . attr ( 'transform' , d => 'translate(' + [ d . target . offset , d . target . depth * rh - 10 ] + ')' )
285+ . attr ( 'class' , 'edgeLabel' )
286+ . attr ( 'font-size' , '0.65em' )
287+ . merge ( edgeLabel )
288+ . text ( d => d . source . node . arguments [ 0 ] . type )
289+ . transition ( )
290+ . attr ( 'transform' , d => 'translate(' + [ d . target . offset , d . target . depth * rh - 10 ] + ')' ) ;
276291 }
277292
278293 updateIncoming ( data , index ) {
0 commit comments