From 2992cab82cbc1a30c6cdf2195b67a418bf63f8e9 Mon Sep 17 00:00:00 2001 From: Eric Mrak Date: Sat, 15 Mar 2014 14:44:27 -0700 Subject: adding showLogVBar --- src/Plugins/Monitors/Common.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs index ecc9db4..70f1b5f 100644 --- a/src/Plugins/Monitors/Common.hs +++ b/src/Plugins/Monitors/Common.hs @@ -49,6 +49,7 @@ module Plugins.Monitors.Common ( , showPercentBar , showVerticalBar , showLogBar + , showLogVBar , showWithUnits , takeDigits , showDigits @@ -470,3 +471,14 @@ showLogBar f v = do | x <= ll = 1 / bw | otherwise = f + logBase 2 (x / hh) / bw showPercentBar v $ choose v + +showLogVBar :: Float -> Float -> Monitor String +showLogVBar f v = do + h <- fromIntegral `fmap` getConfigValue high + l <- fromIntegral `fmap` getConfigValue low + bw <- fromIntegral `fmap` getConfigValue barWidth + let [ll, hh] = sort [l, h] + choose x | x == 0.0 = 0 + | x <= ll = 1 / bw + | otherwise = f + logBase 2 (x / hh) / bw + showVerticalBar v $ choose v -- cgit v1.2.3