fix: fill screen horizontally
before, the line graph would always be one step behind (left)
This commit is contained in:
parent
6d8cff280e
commit
1b814f9688
1 changed files with 1 additions and 1 deletions
|
|
@ -35,7 +35,7 @@ impl canvas::Program<app::Message, Theme, Renderer> for Graph {
|
||||||
frame.stroke(
|
frame.stroke(
|
||||||
&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() - 1) as f32 * bounds.width;
|
||||||
let y = bounds.height - value / 100. * bounds.height;
|
let y = bounds.height - value / 100. * bounds.height;
|
||||||
builder.line_to(Point::new(x, y))
|
builder.line_to(Point::new(x, y))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue