Compare commits

..
Author SHA1 Message Date
9d0a6fdd07
fix: graphs clipping into the bottom of the box
this isn't the greatest solution, but it works as expected
2026-08-15 19:11:34 -07:00
fa0284f165
feat: half the history
this should probably be dynamic (based on screen space).... somehow....
2026-08-15 19:08:05 -07:00

View file

@ -27,7 +27,7 @@ impl Graph {
pub fn update(&mut self, value: f32) { pub fn update(&mut self, value: f32) {
self.timeline.push_back(value); self.timeline.push_back(value);
if self.timeline.len() > 1000 { if self.timeline.len() > 500 {
self.timeline.pop_front(); self.timeline.pop_front();
} }
} }
@ -53,7 +53,7 @@ impl canvas::Program<app::Message, Theme, Renderer> for Graph {
&canvas::Path::new(|builder| { &canvas::Path::new(|builder| {
for (index, value) in self.timeline.iter().enumerate() { for (index, value) in self.timeline.iter().enumerate() {
let x = index as f32 / self.timeline.len() as f32 * bounds.width; let x = index as f32 / self.timeline.len() as f32 * bounds.width;
let y = bounds.height - value / 100. * bounds.height; let y = bounds.height - value / 100. * bounds.height - 1.;
builder.line_to(Point::new(x, y)) builder.line_to(Point::new(x, y))
} }
}), }),