mirror of
https://github.com/fdehau/tui-rs.git
synced 2024-10-30 21:20:22 +00:00
[widgets] Fix a bug in chart layout
This commit is contained in:
parent
cb8af88adf
commit
5dd03d91ad
@ -274,8 +274,16 @@ where
|
||||
y -= 1;
|
||||
}
|
||||
|
||||
if let Some(labels) = self.y_axis.labels {
|
||||
let max_width = labels.iter().fold(0, |acc, l| max(l.as_ref().width(), acc)) as u16;
|
||||
if let Some(y_labels) = self.y_axis.labels {
|
||||
let mut max_width = y_labels.iter().fold(
|
||||
0,
|
||||
|acc, l| max(l.as_ref().width(), acc),
|
||||
) as u16;
|
||||
if let Some(x_labels) = self.x_axis.labels {
|
||||
if x_labels.len() > 0 {
|
||||
max_width = max(max_width, x_labels[0].as_ref().width() as u16);
|
||||
}
|
||||
}
|
||||
if x + max_width < area.right() {
|
||||
layout.label_y = Some(x);
|
||||
x += max_width;
|
||||
|
Loading…
Reference in New Issue
Block a user