Modulo:Demografia/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
ottimizzazioni al codice |
colori, visualizzazione etichette |
||
Riga 38:
-- =====================================================================
local function merge_years_population(years, populations)
end
Riga 50:
-- =====================================================================
function p._demografia(args)
local graph = {
version = 2,
Riga 115:
x = {scale = "x",field = "year"},
y = {scale = "y",field = "population"},
stroke = {value = "#
strokeWidth = {value = 3}
}
Riga 127:
x = {scale = "x",field = "year"},
y = {scale = "y",field = "population"},
stroke = {value = "#
fill = {value = "#fff"},
size = {value = 12}
Riga 140:
x = {scale = "x",field = "year"},
y = {scale = "y",field = "population"},
stroke = {value = "#
fill = {value = "#fff"},
size = {value = 30}
Riga 192:
local years2 = read_array(args, "b", "anni2")
graph['data'][1]['values'] = merge_years_population(years, populations)
if args.etichette then
local etichette = tonumber(args.etichette)
if etichette == 1 or etichette == 2 then
graph['marks'][4]['properties']['transform'] = string.format('{{ type = "filter", test: "datum._id %% 2 == %d"}}', etichette)
end
end
--if true then return mw.text.jsonEncode(graph) end
local template_text = "Censimenti dal {{datum.min_year}} al {{datum.max_year}}"
Riga 205 ⟶ 211:
end
-- ======================================================================================================
-- Funzione di intefaccia con template:Demografia
-- ======================================================================================================
function p.demografia(frame)
local args = getArgs(frame)
|