@@ -55,7 +55,7 @@ function render_pipeline_graph() {
5555
5656 // Draw Y tick marks.
5757 for ( let n = 1 ; n < units . length ; n ++ ) {
58- const y = graph_height - ( n * Y_TICK_DIST ) ;
58+ const y = MARGIN + Y_TICK_DIST * n ;
5959 ctx . beginPath ( ) ;
6060 ctx . moveTo ( X_LINE , y ) ;
6161 ctx . lineTo ( X_LINE - 5 , y ) ;
@@ -64,8 +64,9 @@ function render_pipeline_graph() {
6464
6565 // Draw Y labels.
6666 ctx . textAlign = 'end' ;
67+ ctx . textBaseline = 'middle' ;
6768 for ( let n = 0 ; n < units . length ; n ++ ) {
68- let y = MARGIN + ( Y_TICK_DIST * ( n + 1 ) ) - 13 ;
69+ let y = MARGIN + Y_TICK_DIST * n + Y_TICK_DIST / 2 ;
6970 ctx . fillText ( n + 1 , X_LINE - 4 , y ) ;
7071 }
7172
@@ -108,12 +109,12 @@ function render_pipeline_graph() {
108109 }
109110 ctx . fillStyle = "#000" ;
110111 ctx . textAlign = 'start' ;
111- ctx . textBaseline = 'hanging ' ;
112+ ctx . textBaseline = 'middle ' ;
112113 ctx . font = '14px sans-serif' ;
113114 const label = `${ unit . name } ${ unit . target } ${ unit . duration } s` ;
114115 const text_info = ctx . measureText ( label ) ;
115116 const label_x = Math . min ( x + 5.0 , canvas_width - text_info . width - X_LINE ) ;
116- ctx . fillText ( label , label_x , y + BOX_HEIGHT / 2 - 6 ) ;
117+ ctx . fillText ( label , label_x , y + BOX_HEIGHT / 2 ) ;
117118 draw_dep_lines ( ctx , unit . i , false ) ;
118119 }
119120 ctx . restore ( ) ;
0 commit comments