Content deleted Content added
BrandonXLF (talk | contribs) No edit summary Tag: Reverted |
BrandonXLF (talk | contribs) Syncing sandbox code with main template (sync-template-sandbox.js) |
||
Line 1:
local p = {}
local getArgs = require(
local yesno = require('Module:Yesno')
--------------------------------------------------------------------------------
-- Returns all the dots (with absolute postions)▼
---------- P . D O T S ---------------------------------------------------------
--------------------------------------------------------------------------------
function p.data(frame) -- Returns the data of the graph
local args = getArgs(frame)
Line 25 ⟶ 29:
local yLCount = 0
if yesno(args[
isx = false
else
Line 31 ⟶ 35:
end
if args[
for str in string.gmatch(args[
table.insert(xLabels,
xLCount = xLCount
end
end
if args[
for str in string.gmatch(args[
table.insert(yLabels,
yLCount = yLCount
end
end
if args[
local i = 0
local j = 0
for k,
if string.match(k,
and not string.match(k,
table.insert(yTable,
yCount = yCount
end
end
local cols = yCount / tonumber(args[
if cols ~= math.floor(cols) then
return table.concat({'<span style="font-size:100%" class="error">The amount of y parameters ('
end
while
local xValue =
i
while
j
table.insert(xTable,
xCount = xCount + 1
end
j
end
else -- Divides args into the yTable and the xTable
for k,
if string.match(k,
and not string.match(k,
if isx == false then
table.insert(yTable,
yCount = yCount + 1
isx = true
elseif not args[
table.insert(xTable,
xCount = xCount + 1
isx = false
Line 91 ⟶ 95:
if xCount < yCount then
return table.concat({'<span style="font-size:100%
elseif xCount > yCount then
return table.concat({'<span style="font-size:100%" class="error">The amount of x values ('
end
if args[
colorTime = false
for k,
if colorTime == true then
colorTable[k] = args[
colorTime = false
else
Line 108 ⟶ 112:
end
if args[
colorTime = true
for k,
if colorTime == true then
colorTable[k] = args[
colorTime = false
else
Line 120 ⟶ 124:
end
for k,
if k == mw.ustring.match(k,
num = mw.ustring.gsub(k,
num = tonumber(num)
colorTable[num] = v
Line 128 ⟶ 132:
end
for k,
local
local div = mw.html.create('div')
local size;
if args[
size = tonumber(mw.ustring.match(args[
else
size = 8
end
x = xTable[k]
InnerDiv
:css('position',
:css('top',
:css('left',
:css('line-height',
:wikitext('[[File:Location dot ',
div
:css('position',
:css('bottom',
:css('left',
:wikitext(tostring(
table.insert(dotTable,
end
for k,
local div = mw.html.create('div')
div
:css('position',
:css('bottom',
:css('left',
:wikitext(
table.insert(dotTable,
end
for k,
local div = mw.html.create('div')
div
:css('position',
:css('bottom',
:css('left',
:wikitext(v)
table.insert(dotTable,
end
Line 180 ⟶ 179:
end
---------- L E G E N D ---------------------------------------------------------
---------- Makes the legendTable -----------------------------------------------
local function legend(args)
local color;
local aValue;
local
for k,
if k == mw.ustring.match(k,
color = mw.ustring.gsub(k,
v = table.concat({'<div>[[File:Location dot '
table.insert(
aValue = true
end
end
if aValue == true then
return table.concat(
else
return
end
end
--------------------------------------------------------------------------------
---------- P . G R A P H -------------------------------------------------------
---------- Returns all the dots in div tags-------------------------------------
--------------------------------------------------------------------------------
function p.graph(frame) -- Returns a graph with the dots on it
if mw.ustring.match(p.data(frame),
return p.data(frame)
end
local args = getArgs(frame)
local picture =
local div = mw.html.create('div')
local center = mw.html.create('div')
Line 212 ⟶ 217:
local top = mw.html.create('div')
local size;
if args[
size = tonumber(mw.ustring.match(args[
else
size = 8
end
if args[
if args[
args[
end
end
if args[
picture = args[
elseif yesno(args[
picture =
end
picture = mw.ustring.gsub(picture,
picture = mw.ustring.gsub(picture,
if p.data(frame) ==
return
end
if args[
top -- Create top text
:css('font-weight',
:css('text-decoration',
:css('text-align',
:wikitext(args[
end
container -- Creates container
:css('width',
:css('float',
:css('position',
:wikitext('[[File:',
:wikitext(p.data(frame))
div -- Creates box
:css('width',
:css('display',
:css('float',
:css('margin',
:css('padding',
:css('background',
:wikitext(tostring(top))
:wikitext(tostring(container))
:wikitext(legend(args))
:wikitext(args[
if yesno(args['border']) ~= false then -- Creates box border
div
:css('border-style',
:css('border-color',
:css('border-width',
end
Line 279 ⟶ 278:
center
:addClass('center')
:css('width',
:css('margin-left',
:css('margin-right',
:wikitext(tostring(div))
return center
|