summaryrefslogtreecommitdiffstats
path: root/src/canvas.rs
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2021-04-04 05:38:57 -0400
committerGitHub <noreply@github.com>2021-04-04 05:38:57 -0400
commiteb6a737d3430920061cd5e54bf4dc40da21f1fc5 (patch)
treeb329c4b729f31de80405b3a2d015c1525d80d618 /src/canvas.rs
parent40f4c796f8d1832e7ef9db7c87db558a1ce12b62 (diff)
feature: Rework network y-axis, linear interpolation for off-screen data (#437)
Rewrite of the y-axis labeling and scaling for the network widget, along with more customization. This still has one step to be optimized (cache results so we don't have to recalculate the legend each time), but will be done in another PR for sake of this one being too large already. Furthermore, this change adds linear interpolation at the 0 point in the case a data point shoots too far back - this seems to have lead to ugly gaps to the left of graphs in some cases, because the left hand limit was not big enough for the data point. We address this by grabbing values just outside the time range and linearly interpolating at the leftmost limit. This affects all graph widgets (CPU, mem, network). This can be optimized, and will hopefully be prior to release in a separate change.
Diffstat (limited to 'src/canvas.rs')
-rw-r--r--src/canvas.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/canvas.rs b/src/canvas.rs
index b904e217..1916f200 100644
--- a/src/canvas.rs
+++ b/src/canvas.rs
@@ -9,6 +9,8 @@ use tui::{
Frame, Terminal,
};
+// use ordered_float::OrderedFloat;
+
use canvas_colours::*;
use dialogs::*;
use screens::*;
@@ -54,7 +56,7 @@ pub struct DisplayableData {
pub mem_labels: Option<(String, String)>,
pub swap_labels: Option<(String, String)>,
- pub mem_data: Vec<Point>,
+ pub mem_data: Vec<Point>, // TODO: Switch this and all data points over to a better data structure...
pub swap_data: Vec<Point>,
pub load_avg_data: [f32; 3],
pub cpu_data: Vec<ConvertedCpuData>,