Compare commits

..

View file

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