Modulo:Sandbox/moroboshi2: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
test lettura anno |
r |
||
Riga 4:
local getArgs = require('Module:Arguments').getArgs
local function read_array(raw_data)
local list = mw.text.split(raw_data, ",")
for _,s in ipairs(list) do
data[#data+1] = s
return data
end
local args = getArgs(frame)
local --if #populations ~= #years then return "Dati da wikidata non congruenti" end
if true then
▲ local year_s = {}
for i = 1,
temp[i] = (years[i] or '') .. ': ' .. tostring(populations[i]) .. '<br/>'
end
return table.concat(temp)
if true then return mw.text.jsonEncode(raw_year, mw.text.JSON_PRETTY) .. "<br/>" .. mw.text.jsonEncode(year_s, mw.text.JSON_PRETTY) end▼
end
local graph_args = {▼
▲
ygrid = true,▼
xtitle = 'anni',▼
local
years[i],
populations[i], populations[j] = populations[j], populations[i]
x = { year_s },▼
graph_type = 'rect',▼
seriesTitles = {'Popolazione'},▼
colors = {'#4682B4'}▼
▲ }
local graph_json = mChart.chart_json(graph_args)▼
▲ --if true then return graph_json end
return frame:extensionTag('graph', graph_json)▼
end
ytitle = 'popolazione',
y = { populations },
}
--if true then return graph_json end
end
return p
|