Add support for more histogram buckets

This commit is contained in:
Wuzzy 2022-04-20 03:34:08 +02:00
parent 17581e898c
commit f76245ed1c

View File

@ -874,8 +874,8 @@ local show_histogram_formspec = function(player, stats)
"label[0,7.0;"..F(S("Max.")).."\n"..F(S("Min.")).."]"..
"tooltip[0,6.8;0.7,1;"..F(S("Upper bounds (exclusive) and lower bounds (inclusive) of the noise value data bucketing")).."]"..
"box[0.75,0;0.025,8.3;#FFFFFF80]"..
"box[0,6.65;10.0,0.025;#FFFFFF80]"..
"box[0,7.8;10.0,0.025;#FFFFFF80]"
"box[0,6.65;"..HISTOGRAM_BUCKETS..",0.025;#FFFFFF80]"..
"box[0,7.8;"..HISTOGRAM_BUCKETS..",0.025;#FFFFFF80]"
local hstart = 1
-- Special case: If bucket sizes are equal, only show the last bucket
-- (can happen if scale=0)
@ -941,7 +941,7 @@ local show_histogram_formspec = function(player, stats)
vmin = S("(@1,@2,@3)", stats.start_pos.x, stats.start_pos.y, stats.start_pos.z)
vmax = S("(@1,@2,@3)", stats.end_pos.x, stats.end_pos.y, stats.end_pos.z)
end
local labels = "textarea[0,0;10,2;;;"..
local labels = "textarea[0,0;"..HISTOGRAM_BUCKETS..",2;;;"..
F(S("Values were picked randomly between noise coordinates @1 and @2.", vmin, vmax)).."\n"..
F(S("Values calculated: @1", stats.value_count)).."\n"..
F(S("Minimum calculated value: @1", stats.min)).."\n"..
@ -949,17 +949,17 @@ local show_histogram_formspec = function(player, stats)
F(S("Average calculated value: @1", stats.avg)).."]\n"
local form = [[
formspec_version[4]size[11,12.5]
formspec_version[4]size[]]..(HISTOGRAM_BUCKETS+1)..[[,12.5]
container[0.25,0.25]
box[0,0;10.5,2.5;]]..FORMSPEC_BOX_COLOR..[[]
box[0,0;10.5,0.4;]]..FORMSPEC_HEADER_COLOR..[[]
box[0,0;]]..(HISTOGRAM_BUCKETS+0.5)..[[,2.5;]]..FORMSPEC_BOX_COLOR..[[]
box[0,0;]]..(HISTOGRAM_BUCKETS+0.5)..[[,0.4;]]..FORMSPEC_HEADER_COLOR..[[]
label[0.25,0.2;]]..F(S("Noise Value Statistics"))..[[]
container[0.25,0.5]
]]..labels..[[
container_end[]
container[0,2.75]
box[0,0;10.5,9.0;]]..FORMSPEC_BOX_COLOR..[[]
box[0,0;10.5,0.4;]]..FORMSPEC_HEADER_COLOR..[[]
box[0,0;]]..(HISTOGRAM_BUCKETS+0.5)..[[,9.0;]]..FORMSPEC_BOX_COLOR..[[]
box[0,0;]]..(HISTOGRAM_BUCKETS+0.5)..[[,0.4;]]..FORMSPEC_HEADER_COLOR..[[]
label[0.25,0.2;]]..F(S("Noise Value Histogram"))..[[]
container[0.25,0.6]
]]..histogram..[[