Module:Sandbox/Frietjes/political graph: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 2:
local p = {}
 
function p.chart(frame, args, flag)
local chartfun = require('Module:Graph').chart
local pfetch = require('Module:Political party')._fetch
local tframe = {}
tframe.args = {}
local colors = mw.text.split(frame.args['colors'] or '', '%s*[,]%s*')
local tracking = ''
for k,v in pairs(frame.args) do
if k:find('^y[%d]+Party$') then
local digit = mw.ustring.match(k, '[%d]+')
local color = colors[tonumber(digit)] or pfetch({v, 'color'})
local pname = frame.args['y' .. digit .. 'Title'] or pfetch({v, 'abbrev'})
if flag == 1 then
tframe.args['y' .. digit .. 'Title'] = pname
else
Line 29:
 
function p.chartWrapper(frame)
return p.chart(frame, frame:getParent().args['debug'])
end