ENH make axis text more compact

This commit is contained in:
Nathan Dwarshuis 2021-07-13 23:01:28 -04:00
parent 6218bbd73a
commit 3efe2d8b6b
2 changed files with 4 additions and 11 deletions

View File

@ -4,14 +4,14 @@ local Util = require 'Util'
local Common = require 'Common'
local __string_gmatch = string.gmatch
local __math_floor = math.floor
local _PLOT_SEC_BREAK_ = 20
local _PLOT_HEIGHT_ = 56
local network_label_function = function(bits)
local new_unit, new_value = Util.convert_data_val(bits)
local precision = new_value < 10 and 1 or 0
return Util.round_to_string(new_value, precision)..' '..new_unit..'b/s'
return __math_floor(new_value)..' '..new_unit..'b/s'
end
local value_format_function = function(bits)

View File

@ -5,6 +5,7 @@ local Common = require 'Common'
local __tonumber = tonumber
local __string_match = string.match
local __math_floor = math.floor
local _PLOT_SEC_BREAK_ = 20
local _PLOT_HEIGHT_ = 56
@ -24,25 +25,17 @@ local update_stat = function(cr, stat, byte_cnt, update_frequency)
local delta_bytes = byte_cnt - stat.prev_byte_cnt
stat.prev_byte_cnt = byte_cnt
-- local text_value = '0.00 B/s'
local plot_value = 0
if delta_bytes > 0 then
local bps = delta_bytes * update_frequency
-- local unit, value = Util.convert_data_val(bps)
-- text_value = Util.precision_round_to_string(value, 3)..' '..unit..'B/s'
plot_value = bps
end
-- Common.annotated_scale_plot_set(stat, cr, text_value, plot_value)
Common.annotated_scale_plot_set(stat, cr, plot_value)
end
local io_label_function = function(bytes)
local new_unit, new_value = Util.convert_data_val(bytes)
local precision = 0
if new_value < 10 then precision = 1 end
return Util.round_to_string(new_value, precision)..' '..new_unit..'B/s'
return __math_floor(new_value)..' '..new_unit..'B/s'
end
local format_value_function = function(bps)