Fix wrong histogram for special case scale=0
This commit is contained in:
parent
3e9435f260
commit
ae15300c66
9
init.lua
9
init.lua
@ -731,7 +731,14 @@ local show_histogram_formspec = function(player, stats)
|
||||
local maxh = 6.0
|
||||
local boxes = ""
|
||||
boxes = boxes .. "label[0,7.0;"..F(S("Max.")).."\n"..F(S("Min.")).."]"
|
||||
for h=1, HISTOGRAM_BUCKETS do
|
||||
local hstart = 1
|
||||
-- Special case: If bucket sizes are equal, only show the last bucket
|
||||
-- (can happen if scale=0)
|
||||
if HISTOGRAM_BUCKETS > 1 and stats.histogram_points[1] == stats.histogram_points[2] then
|
||||
hstart = HISTOGRAM_BUCKETS
|
||||
end
|
||||
-- Drawn histogram bars, tooltips and labels
|
||||
for h=hstart, HISTOGRAM_BUCKETS do
|
||||
local count = stats.histogram[h]
|
||||
local ratio = (stats.histogram[h] / stats.value_count)
|
||||
local perc = ratio * 100
|
||||
|
Loading…
x
Reference in New Issue
Block a user