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

Content deleted Content added
No edit summary
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 11:
local targs = {}
for k,v in pairs(args) do
if k:find('^y[%d]+Party$') then
local digit = mw.ustringstring.match(k, '[%d]+')
local color = isnotempty(colors[tonumber(digit)]) and colors[tonumber(digit)] or pfetch({v, 'color'})
local pname = isnotempty(args['y' .. digit .. 'Title']) and args['y' .. digit .. 'Title'] or pfetch({v, 'abbrev'})
Line 21:
end
end
targs['colors'] = mw.ustringstring.gsub(table.concat(colors, ', '), '#', '#')
 
return targs
end
 
function p.testdebug(frame)
local args = p._chart_args(frame:getParent().args)
local res = '<pre>\n{{Graph:Chart\n'
Line 37:
end
 
function p.templatemain(frame)
return mw.getCurrentFrame():expandTemplate{
title = 'Graph:Chart',
Line 44:
end
 
function p.mainmainlua(frame)
local graphgraphchart = require('Module:Graph:Chart')
newframeframe.args = p._chart_args(frame:getParent().args)
local newFrame = {
return graphchart[''](frame)
getParent = function(self)
return frame
end,
getTitle = function(self)
return 'Template:Graph:Chart'
end,
args = {}
}
newframe.args = p._chart_args(frame:getParent().args)
return frame:extensionTag{ name='templatestyles', args={src='Template:Graph:Chart/styles.css'} },
frame:extensionTag('graph', graph.chartWrapper(newFrame))
end