Modulo:Sandbox/moroboshi2: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Moroboshi (discussione | contributi)
Nessun oggetto della modifica
Moroboshi (discussione | contributi)
test lettura anno
Riga 1:
local p = {}
local mWikidata = require('Modulo:Wikidata')
local mChart = require('Modulo:Chart')
local getArgs = require('Module:Arguments').getArgs
 
 
function p.demograph(frame)
local args = getArgs(frame)
local raw_dataraw_populations = mWikidata._getProperty({'P1082', from=args[1], rank='normal'}, true)
local raw_year = mWikidata._getQualifier({'P1082', 'P585', from=args[1], rank='normal'}, true)
local demograph_datapopulations = {}
--if true then return mw.text.jsonEncode(demograph_data, mw.text.JSON_PRETTY) end
local xyear_s = {}
for i =1, #raw_dataraw_populations do
x year_s[#raw_populations-i+1] = raw_year[i]
demograph_data populations[#raw_dataraw_populations-i+1] = raw_dataraw_populations[i]
x = x,end
-- if true then return mw.text.jsonEncode(demograph_dataraw_year, mw.text.JSON_PRETTY) .. "<br/>" .. mw.text.jsonEncode(year_s, mw.text.JSON_PRETTY) end
local graph_args = {
ygrid = true,
xtitle = 'anni',
ytitle = 'popolazione',
y = { demograph_datapopulations },
colors x = {'#4682B4' 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
local graph_args = {
ygrid = true,
xtitle = 'anni',
ytitle = 'popolazione',
y = { demograph_data },
x = x,
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
 
return p