Content deleted Content added
BrandonXLF (talk | contribs) No edit summary |
BrandonXLF (talk | contribs) Don't add border:none to improve compatibility with skin dark mode CSS |
||
(59 intermediate revisions by 2 users not shown) | |||
Line 8:
--------------------------------------------------------------------------------
function p.
local args = getArgs(frame)
-- Dot related
Line 24:
-- X label related
local xLabels = {}
-- Y label related
local yLabels = {}
local yLCount = 0
if yesno(args["yx"]) == true then
Line 31 ⟶ 33:
else
isx = true
end▼
if args["x labels"] then -- Create xLabels▼
for str in string.gmatch(args["x labels"], "([^,]+)") do▼
end▼
end▼
if args["y labels"] then -- Create yLabels▼
table.insert(yLabels,str)
yLCount = yLCount+1
end▼
end
Line 52 ⟶ 68:
while(cols>i) do
local xValue = ((100/cols*i)+(100/cols/
i=i+1
while(tonumber(args["dots"])>j) do
Line 114 ⟶ 130:
colorTable[num] = v
end
▲ end
▲ if args["x labels"] then -- Create xLabels
▲ for str in string.gmatch(args["x labels"], "([^,]+)") do
▲ xLabels[i] = str
▲ i = i + 1
▲ end
▲ end
▲ if args["y labels"] then -- Create yLabels
▲ for str in string.gmatch(args["x labels"], "([^,]+)") do
▲ end
end
Line 148 ⟶ 150:
div
:css('position','absolute')
:css('bottom',table.concat({y*0.85+15,'%'}))
:css('left',table.concat({x*0.
:wikitext(tostring(InnerDiv))
table.insert(dotTable,tostring(div))
end
local div = mw.html.create('div')
div
:css('bottom','0%')
:css('left',table.concat({((100/xLCount*k-100/xLCount)*0.85+15)-4,'%'}))
table.insert(dotTable,tostring(div))
end▼
for k,v in pairs(yLabels) do
local div = mw.html.create('div')
div
:css('position','absolute')
:css('bottom',table.concat({(((((100/yLCount*k-100/yLCount)-(100/yLCount/3))+5))+100/yLCount/2)*1.02,'%'}))
:css('left','0%')
:wikitext(v)
table.insert(dotTable,tostring(div))
return table.concat(dotTable)
end
Line 184 ⟶ 207:
function p.graph(frame) -- Returns a graph with the dots on it
if mw.ustring.match(p.
return p.
end
local args = getArgs(frame)
Line 215 ⟶ 238:
picture = mw.ustring.gsub(picture,'.-:','')
if p.
return ""
▲ end
▲ local labelNum = 0
▲ for _,_ in pairs(lableTable) do
▲ end
end▼
▲ :css('text-align','center')
▲ :wikitext(labelDiv)
end
Line 260 ⟶ 255:
:css('position','relative')
:wikitext('[[File:',picture,'|',args["width"] or '240px',']]')
:wikitext(p.
div -- Creates box
:css('width', args["width"] or '240px')
:css('display', 'inline-block')
:css('float', args["align"] or 'right')
:css('margin', args["margin"] or '2px')
:css('padding', args["padding"] or table.concat({size/2,'px'}))
:css('background',args["color"] or 'none')▼
:wikitext(tostring(top))
:wikitext(tostring(container))
:wikitext(legend(args))
:wikitext(args["bottom"])
if args["color"] then
if yesno(args['border']) ~= false then -- Creates box border
|