fix stacked chart gaps caused by rounding error
This commit is contained in:
parent
1d4e450c99
commit
da931f031b
|
|
@ -79,8 +79,8 @@ fn draw_scaled_graph(image: &mut RgbImage, graph: &StackedSeries) {
|
|||
let color = colors[series_idx];
|
||||
let height_px = (graph.config.height_px as f32) * sample * scale;
|
||||
if height_px > 1f32 {
|
||||
let rect = Rect::at(x_offset as i32, (y_offset - height_px) as i32)
|
||||
.of_size(graph.config.width_px_per_sample, height_px as u32);
|
||||
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.ceil() as u32);
|
||||
draw_filled_rect_mut(image, rect, color);
|
||||
y_offset -= height_px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue