fix stacked chart gaps caused by rounding error

This commit is contained in:
Ondrej Novak 2026-06-19 23:36:22 +02:00
parent 1d4e450c99
commit da931f031b
Signed by: handy
SSH Key Fingerprint: SHA256:jlNm8ijkaMl4X7+nn3zBFTJufdQgT4unKJoZVH6kYTM
1 changed files with 2 additions and 2 deletions

View File

@ -79,8 +79,8 @@ fn draw_scaled_graph(image: &mut RgbImage, graph: &StackedSeries) {
let color = colors[series_idx]; let color = colors[series_idx];
let height_px = (graph.config.height_px as f32) * sample * scale; let height_px = (graph.config.height_px as f32) * sample * scale;
if height_px > 1f32 { if height_px > 1f32 {
let rect = Rect::at(x_offset as i32, (y_offset - height_px) as i32) let rect = Rect::at(x_offset as i32, (y_offset - height_px).ceil() as i32)
.of_size(graph.config.width_px_per_sample, height_px as u32); .of_size(graph.config.width_px_per_sample, height_px.ceil() as u32);
draw_filled_rect_mut(image, rect, color); draw_filled_rect_mut(image, rect, color);
y_offset -= height_px; y_offset -= height_px;
} }