@@ -44,14 +44,14 @@ function render_pipeline_graph() {
44
44
const units = UNIT_DATA . filter ( unit => unit . duration >= min_time ) ;
45
45
46
46
const graph_height = Y_TICK_DIST * units . length ;
47
- const { ctx, graph_width, width , height , px_per_sec} = draw_graph_axes ( 'pipeline-graph' , graph_height ) ;
47
+ const { ctx, graph_width, canvas_width , canvas_height , px_per_sec} = draw_graph_axes ( 'pipeline-graph' , graph_height ) ;
48
48
const container = document . getElementById ( 'pipeline-container' ) ;
49
- container . style . width = width ;
50
- container . style . height = height ;
49
+ container . style . width = canvas_width ;
50
+ container . style . height = canvas_height ;
51
51
52
52
// Canvas for hover highlights. This is a separate layer to improve performance.
53
- const linectx = setup_canvas ( 'pipeline-graph-lines' , width , height ) ;
54
- linectx . clearRect ( 0 , 0 , width , height ) ;
53
+ const linectx = setup_canvas ( 'pipeline-graph-lines' , canvas_width , canvas_height ) ;
54
+ linectx . clearRect ( 0 , 0 , canvas_width , canvas_height ) ;
55
55
56
56
// Draw Y tick marks.
57
57
for ( let n = 1 ; n < units . length ; n ++ ) {
@@ -112,7 +112,7 @@ function render_pipeline_graph() {
112
112
ctx . font = '14px sans-serif' ;
113
113
const label = `${ unit . name } ${ unit . target } ${ unit . duration } s` ;
114
114
const text_info = ctx . measureText ( label ) ;
115
- const label_x = Math . min ( x + 5.0 , graph_width - text_info . width ) ;
115
+ const label_x = Math . min ( x + 5.0 , canvas_width - text_info . width - X_LINE ) ;
116
116
ctx . fillText ( label , label_x , y + BOX_HEIGHT / 2 - 6 ) ;
117
117
draw_dep_lines ( ctx , unit . i , false ) ;
118
118
}
@@ -156,7 +156,7 @@ function render_timing_graph() {
156
156
const TOP_MARGIN = 10 ;
157
157
const GRAPH_HEIGHT = AXIS_HEIGHT - TOP_MARGIN ;
158
158
159
- const { width , graph_width, ctx} = draw_graph_axes ( 'timing-graph' , AXIS_HEIGHT ) ;
159
+ const { canvas_width , graph_width, ctx} = draw_graph_axes ( 'timing-graph' , AXIS_HEIGHT ) ;
160
160
161
161
// Draw Y tick marks and labels.
162
162
let max_v = 0 ;
@@ -235,7 +235,7 @@ function render_timing_graph() {
235
235
// Draw a legend.
236
236
ctx . restore ( ) ;
237
237
ctx . save ( ) ;
238
- ctx . translate ( width - 200 , MARGIN ) ;
238
+ ctx . translate ( canvas_width - 200 , MARGIN ) ;
239
239
// background
240
240
ctx . fillStyle = '#fff' ;
241
241
ctx . strokeStyle = '#000' ;
@@ -300,11 +300,11 @@ function draw_graph_axes(id, graph_height) {
300
300
// browsers, but should be ok for many desktop environments.
301
301
const graph_width = Math . min ( scale * DURATION , 4096 ) ;
302
302
const px_per_sec = Math . floor ( graph_width / DURATION ) ;
303
- const width = Math . max ( graph_width + X_LINE + 30 , X_LINE + 250 ) ;
304
- const height = graph_height + MARGIN + Y_LINE ;
305
- let ctx = setup_canvas ( id , width , height ) ;
303
+ const canvas_width = Math . max ( graph_width + X_LINE + 30 , X_LINE + 250 ) ;
304
+ const canvas_height = graph_height + MARGIN + Y_LINE ;
305
+ let ctx = setup_canvas ( id , canvas_width , canvas_height ) ;
306
306
ctx . fillStyle = '#f7f7f7' ;
307
- ctx . fillRect ( 0 , 0 , width , height ) ;
307
+ ctx . fillRect ( 0 , 0 , canvas_width , canvas_height ) ;
308
308
309
309
ctx . lineWidth = 2 ;
310
310
ctx . font = '16px sans-serif' ;
@@ -325,11 +325,11 @@ function draw_graph_axes(id, graph_height) {
325
325
for ( let n = 0 ; n < num_ticks ; n ++ ) {
326
326
const x = X_LINE + ( ( n + 1 ) * tick_dist ) ;
327
327
ctx . beginPath ( ) ;
328
- ctx . moveTo ( x , height - Y_LINE ) ;
329
- ctx . lineTo ( x , height - Y_LINE + 5 ) ;
328
+ ctx . moveTo ( x , canvas_height - Y_LINE ) ;
329
+ ctx . lineTo ( x , canvas_height - Y_LINE + 5 ) ;
330
330
ctx . stroke ( ) ;
331
331
332
- ctx . fillText ( `${ ( n + 1 ) * step } s` , x , height - Y_LINE + 20 ) ;
332
+ ctx . fillText ( `${ ( n + 1 ) * step } s` , x , canvas_height - Y_LINE + 20 ) ;
333
333
}
334
334
335
335
// Draw vertical lines.
@@ -344,7 +344,7 @@ function draw_graph_axes(id, graph_height) {
344
344
}
345
345
ctx . strokeStyle = '#000' ;
346
346
ctx . setLineDash ( [ ] ) ;
347
- return { width , height , graph_width, graph_height, ctx, px_per_sec} ;
347
+ return { canvas_width , canvas_height , graph_width, graph_height, ctx, px_per_sec} ;
348
348
}
349
349
350
350
function round_up ( n , step ) {
0 commit comments