Modulo:Demografia/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
mNessun oggetto della modifica
Riga 48:
-- Crea tabella laterale
-- =====================================================================
local function mostraTabella(a,b,f)
local ss = {}
table.insert(ss,'</td><td style="vertical-align:top"><table class="wikitable" style="font-size:smaller;text-align:right"><tr><th>Anno</th><th>Abitanti</th>')
Riga 55:
local c = math.floor(0.5+#b/2)
for i =1,c do
table.insert(ss,string.format('<tr><th>%s</th><td>%s</td>',a[i],math.floor(b[i]*f+0.5)))
if b[i+c] then table.insert(ss,string.format('<th>%s</th><td>%s</td>',a[i+c],math.floor(b[i+c]*f+0.5))) end
table.insert(ss,'</tr>')
end
Riga 62:
table.insert(ss,'</tr>')
for i =1,#b do
table.insert(ss,string.format('<tr><th>%s</th><td>%s</td></tr>',a[i],math.floor(b[i]*f+0.5)))
end
end
Riga 225:
local tabella1 = ''
local tabella2 = ''
local fattore = args.fattore and tonumber(args.fattore) and tonumber(args.fattore) or 1
if fattore == 1000 then
graph['axes'][2]['title'] = 'Abitanti (migliaia)'
elseif fattore == 1000000 then
graph['axes'][2]['title'] = 'Abitanti (milioni)'
end
if args.etichette then
if args.etichette == "dispari" then
-- mostra solo etichette dispari
graph['marks'][4]['from']['transform'] = {{ type = "filter", test = "(datum.num > 1) && (datum.num % 2 == 1)"}}
elseif args.etichette == "pari" then
-- mostra solo etichette pari
graph['marks'][4]['from']['transform'] = {{ type = "filter", test = "(datum.num > 1) && (datum.num % 2 == 0)"}}
elseif args.etichette == "tabella" then
-- nasconde etichette e crea tabella a fianco
graph['marks'][4]['from']['transform'] = {{ type = "filter", test = "datum.num < 1"}}
tabella1 = '<table><tr><td style="vertical-align:top">'
tabella2 = mostraTabella(years, populations, fattore)
end
else