summaryrefslogtreecommitdiffstats
path: root/src/canvas.rs
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-12-22 01:12:13 -0500
committerGitHub <noreply@github.com>2020-12-22 01:12:13 -0500
commit9d1f3c9ac2e8f816e275ed46c43d0f1d56a335e7 (patch)
tree1f5d33203bc60109491197f168c794804ed3151b /src/canvas.rs
parent837c382ee9461dfd7b80fecf8871bb762ae1e639 (diff)
feature: Hide SWAP graph and legend in normal mode if SWAP is 0 (#372)
Firstly, note this currently won't affect basic mode. There is code changes due to it, but instead, we'll just display `0.0B/0.0B` instead. I'm personally not really sure if we want to get rid of it in basic mode, since it'll leave an ugly gap in that mode. Anyways, this change is mainly for the normal mode. All this does is hide the legend entry and chart if the total SWAP drops to 0 KB. It also has a small change to do a unit check on the memory used, as well as slightly adjusting the calculation we use.
Diffstat (limited to 'src/canvas.rs')
-rw-r--r--src/canvas.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/canvas.rs b/src/canvas.rs
index 7fdba228..e0aff886 100644
--- a/src/canvas.rs
+++ b/src/canvas.rs
@@ -50,10 +50,10 @@ pub struct DisplayableData {
pub single_process_data: HashMap<Pid, ConvertedProcessData>, // Contains single process data, key is PID
pub finalized_process_data_map: HashMap<u64, Vec<ConvertedProcessData>>, // What's actually displayed, key is the widget ID.
pub stringified_process_data_map: HashMap<u64, Vec<(Vec<(String, Option<String>)>, bool)>>, // Represents the row and whether it is disabled, key is the widget ID
- pub mem_label_percent: String,
- pub swap_label_percent: String,
- pub mem_label_frac: String,
- pub swap_label_frac: String,
+
+ pub mem_labels: Option<(String, String)>,
+ pub swap_labels: Option<(String, String)>,
+
pub mem_data: Vec<Point>,
pub swap_data: Vec<Point>,
pub cpu_data: Vec<ConvertedCpuData>,