Modulo:Demografia/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica
use require("strict") instead of require("Module:No globals")
 
(3 versioni intermedie di un altro utente non mostrate)
Riga 1:
require("Module:No globalsstrict")
local getArgs = require('Module:Arguments').getArgs
local p = {}
Riga 45:
if (minimo == nil or years[i] < minimo) then minimo = years[i] end
if (massimo == nil or years[i] > massimo) then massimo = years[i] end
t = string.format("%g",math.floor(10*populations[i]+0.5)/10)
t = t:gsub('%.',',')
values[i] = { year = years[i], population = populations[i], num = i, txt = t }
Riga 229:
fill = {value = "black"},
fontSize = {value = 14},
font = {value = "Helvetica"},
align = {value = "center"},
fontWeight = {value = "bold"}
Riga 260 ⟶ 261:
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
Riga 270 ⟶ 271:
tabella2 = mostraTabella(years, populations, fattore)
end
else
graph['marks'][4]['from']['transform'] = {{ type = "filter", test = "datum.num > 1"}}
end
--if true then return mw.text.jsonEncode(graph) end
Riga 282 ⟶ 281:
if (massimo - minimo > 1) then
graph['scales'][1]['domainMin'] = minimo - (massimo-minimo)*0.0504
graph['scales'][1]['domainMax'] = massimo + (massimo-minimo)*0.0504
end