Fix divide by zero errors.
This commit is contained in:
parent
65eb941eb4
commit
7b2c77b2d9
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue