Moduł:Wykres: Różnice pomiędzy wersjami

Przejdź do nawigacji Przejdź do wyszukiwania
Dodane 675 bajtów ,  5 lat temu
updated from de.wikipedia.org
(import z enwiki)
 
(updated from de.wikipedia.org)
-- 2016-01-09 _PLEASE UPDATE when modifying anything_
-- 2016-01-28 For maps, always use wikiraw:// protocol. https:// will be disabled soon.
-- 2016-03-20 Allow omitted data for charts, labels for line charts with string (ordinal) scale at point location
-- 2016-05-16 Added encodeTitleForPath() to help all path-based APIs graphs like pageviews
 
local p = {}
 
local baseMapDirectory = "ModułModule:WykresGraph/"
 
local function numericArray(csv)
local isInteger = true
for i = 1, #list do
resultif list[i] == tonumber(list[i])"" then
if not result[i] then return= endnil
else
if isInteger then
local int, fracresult[i] = math.modftonumber(resultlist[i])
if not result[i] then return end
isInteger = frac == 0.0
if isInteger then
local int, frac = math.modf(result[i])
isInteger = frac == 0.0
{end
end
end
}
for i = 1, #y do
local yLen = table.maxn(y[i])
for j = 1, #x do
if j <= #yLen and y[i][j] then table.insert(data.values, { series = seriesTitles[i], x = x[j], y = y[i][j] }) end
end
end
else
if xType == "date" then xscale.type = "time"
elseif xType == "string" then xscale.type = "ordinal" end
xscale.type = "aggregateordinal",
xscale.points = true
end
end
 
end
end
local y
y, yType, yMin, yMax = deserializeYData(yValues, yType, yMin, yMax)
 
chartType = string.sub(chartType, 8)
if #y > 1 then -- ignore stacked charts if there is only one series
stacked = true
-- aggregate data by cumulative y values
stats =
{
name = "stats", source = "chart", transform =
{
{
type = "aggregate",
name = "stats", source = "chart", transform =
groupby = { "x" },
summarize = { y = "sum" }
{
type = "aggregate",
groupby = { "x" },
summarize = { y = "sum" }
}
}
}
}
}
end
end
function p.chartWrapper(frame)
return p.chart(frame:getParent())
end
 
-- Given an HTML-encoded title as first argument, e.g. one produced with {{ARTICLEPAGENAME}},
-- convert it into a properly URL path-encoded string
-- This function is critical for any graph that uses path-based APIs, e.g. PageViews graph
function p.encodeTitleForPath(frame)
return mw.uri.encode(mw.text.decode(mw.text.trim(frame.args[1])), 'PATH')
end
 
3057

edycji

Menu nawigacyjne