Skip to content

Commit

Permalink
fix subtraction underflow in heatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroXbrock committed Feb 6, 2025
1 parent 65e1437 commit 4c0f547
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/cli/src/commands/report/chart/heatmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ impl HeatMapChart {
let brightness = (i * 255 / max_incidence) as u8;
let (r, g, b) = rgb_gradient(brightness);
let y_start = legend_height - (i * (legend_height / max_incidence));
let y_end = y_start - (legend_height / max_incidence);
let chunk_size = legend_height / max_incidence;
let y_end = y_start.max(chunk_size) - chunk_size;

legend_area.draw(&Rectangle::new(
[(50, y_start as i32), (80, y_end as i32)], // Small vertical bar
Expand Down

0 comments on commit 4c0f547

Please sign in to comment.