Module:Chart: Difference between revisions

Content deleted Content added
m replace deprecated "Image:" with "File:"
Change ___location that 'barHeight' capping is done so that 'top' uses the correct value
Line 314:
 
local function calcHeights( gi, i, val )
local barHeight = math.max(2, math.floor( val / yscales[gi] * chartHeight + 0.5 )) -- add half to make it "round" instead of "trunc", min height to 2 to avoid negative bar sizes
local top, base = chartHeight - barHeight, 0
if stack then
Line 321:
base = math.floor( chartHeight * rawbase / yscales[gi] ) -- normally, and especially if it's "stack", all the yscales must be equal.
end
if barHeight < 2 then
barHeight = 2 -- Otherwise the template would try to create a bar with a negative height
end
return barHeight, top - base
end