打开/关闭菜单
切换首选项菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:PChart:修订间差异

来自异世界百科
删除的内容 添加的内容
落雨枫留言 | 贡献
更改大小
落雨枫留言 | 贡献
增加图例功能
第16行: 第16行:
local float = getArg(frame.args, "float")
local float = getArg(frame.args, "float")
local values = getArg(frame.args, "values", "")
local values = getArg(frame.args, "values", "")
local legend = getArg(frame.args, "legend")
local html = ""
local html = ""
第21行: 第22行:
html = html .. "<div class=\"float" .. float .. "\">"
html = html .. "<div class=\"float" .. float .. "\">"
end
end
local attributes = {
size = size,
ymax = max,
filled = "",
striped = "",
}
if(legend == "true" or legend == "1") then
attributes["legend"] = ""
end
html = html ..
html = html ..
frame:extensionTag("pRadar", "," .. names .. "\n" .. values, {
frame:extensionTag("pRadar", "," .. names .. "\n" .. values, attributes)
size = size,
ymax = max,
filled = "",
striped = "",
})
if(float ~= nil and float ~= "center") then
if(float ~= nil and float ~= "center") then
html = html .. "</div>"
html = html .. "</div>"

2021年6月5日 (六) 14:13的版本

此模块的文档可以在模块:PChart/doc创建

local p = {}

function getArg(args, key, default)
	local val = args[key]
	if(val == nil or #val == 0 or val == "{{{" .. key .. "}}}") then
		return default
	else
		return val
	end
end

function p.radar(frame)
	local size = getArg(frame.args, "size", "320x300")
	local max = getArg(frame.args, "max", "5")
	local names = getArg(frame.args, "names", "Data")
	local float = getArg(frame.args, "float")
	local values = getArg(frame.args, "values", "")
	local legend = getArg(frame.args, "legend")
	
	local html = ""
	if(float ~= nil and float ~= "center") then
		html = html .. "<div class=\"float" .. float .. "\">"
	end
	
	local attributes = {
		size = size,
		ymax = max,
		filled = "",
		striped = "",
	}
	
	if(legend == "true" or legend == "1") then
		attributes["legend"] = ""
	end
	
	html = html ..
		frame:extensionTag("pRadar", "," .. names .. "\n" .. values, attributes)
	if(float ~= nil and float ~= "center") then
		html = html .. "</div>"
	end
	
	return html
end

return p