Jump to content

Module:Medical cases chart and Module:Medical cases chart/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
add weeklyoffset
 
cleanup
 
Line 1: Line 1:
local yesno = require('Module:Yesno')
local yesno = require('Module:Yesno')
local BarBox = unpack(require('Module:Bar'))
local BarBox = unpack(require('Module:Bar/sandbox'))


local lang = mw.getContentLanguage()
local lang = mw.getContentLanguage()
Line 585: Line 585:
change = '+' .. lang:formatNum(nChange)
change = '+' .. lang:formatNum(nChange)
end
end
elseif changetype == 'w' and args.population then -- changetype == 'r' or
elseif (changetype == 'w' and args.population) then -- changetype == 'r' or
-- change type is "r"(olling average over 7 days period) or "w"(eekly incidence per 100.000 pop)
-- change type is "r"(olling average over 7 days period) or "w"(eekly incidence per 100.000 pop)
if barargs.nDate and rows then
if barargs.nDate and rows then
Line 661: Line 661:


local bars, dateList = {}, {}
local bars, dateList = {}, {}
args.weeklyoffset = tonumber(args.weeklyoffset) or 0
for i, row in ipairs(rows) do -- build rows
for i, row in ipairs(rows) do -- build rows
if (not yesno(args.weekly)) or (math.mod(i-1+args.weeklyoffset, 7) == 0) then
if (not yesno(args.weekly)) or (math.mod(i-1, 7) == 0) then
row.divisor = divisor
row.divisor = divisor
row.numwidth = args.numwidth
row.numwidth = args.numwidth
Line 814: Line 813:
buildargs.population = args.population
buildargs.population = args.population
buildargs.weekly = args.weekly
buildargs.weekly = args.weekly
buildargs.weeklyoffset = args.weeklyoffset


local dateList
local dateList