Fix divide by zero errors.

This commit is contained in:
Bauke 2023-07-10 17:49:15 +02:00
parent 65eb941eb4
commit 7b2c77b2d9
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ impl UserCountChart {
.configure_mesh()
.x_labels(datapoints.len() + 2)
.x_label_formatter(&|x| {
if (x - 1) % (datapoints_len / 20) != 0 {
if (x - 1) % (datapoints_len / 20).max(1) != 0 {
String::new()
} else {
format!("{:0}", datapoints_len - x)
@ -122,7 +122,7 @@ impl UserCountChart {
)
+ Text::new(
{
if (x - 1) % (datapoints_len / 10) != 0 {
if (x - 1) % (datapoints_len / 10).max(1) != 0 {
String::new()
} else {
format!("{:0}", y)