편집 요약 없음 |
편집 요약 없음 |
||
5번째 줄: | 5번째 줄: | ||
} | } | ||
table_.data[1] = { | table_.data[1] = { | ||
name = "table", | |||
values = { | |||
{category = "USB 3.2 Gen 2x2", amount = 20}, | |||
{category = "USB 3.2 Gen 2(구 명칭 USB 3.1 Gen2, USB 3.1)", amount = 10}, | |||
{category = "USB 3.2 Gen 1(구 명칭 USB 3.1 Gen 1, USB 3.0) ", amount = 5}, | |||
{category = "USB 2.0", amount = 0.480}, | |||
{category = "USB 1.0", amount = 0.12} | |||
} | |||
--[[ | |||
local i = 1 | |||
while values[i] do | |||
values.category = args[i..'이름'] | |||
values.amount = args[i..'수치'] | |||
i = i + 1 | |||
end | |||
]] | |||
} | } | ||
table_.signals[1] = { | table_.signals[1] = {} | ||
table_.signals[1].name = "tooltip" | |||
table_.signals[1].value = {} | |||
table_.signals[1].on = { | |||
{events = "rect:mouseover", update = "datum"}, | {events = "rect:mouseover", update = "datum"}, | ||
{events = "rect:mouseout", update = "{}"} | {events = "rect:mouseout", update = "{}"} | ||
} | } | ||
38번째 줄: | 46번째 줄: | ||
table_.scales[2].round = true | table_.scales[2].round = true | ||
table_.axes[1] = {type = "x", scale = "x", title = "Gbps"} | table_.axes[1] = {type = "x", scale = "x", title = "Gbps" } --축 이름 | ||
table_.axes[2] = {type = "y", scale = "y"} | table_.axes[2] = {type = "y", scale = "y", title = "" } --축 이름 | ||
table_.marks[1] = {} | table_.marks[1] = {} | ||
table_.marks[1].type = "rect" | table_.marks[1].type = "rect" --타입 | ||
table_.marks[1].from = {data = "table"} | table_.marks[1].from = {data = "table"} | ||
56번째 줄: | 64번째 줄: | ||
} | } | ||
table_.marks[1].properties.hover = { | table_.marks[1].properties.hover = { | ||
strokeWidth = {value = 1}, | strokeWidth = {value = 1}, --선 두께 | ||
stroke = {value = "#4188F1"}, | stroke = {value = "#4188F1"}, --스트로크 | ||
fill = {value = "#F5F8FA"} | fill = {value = "#F5F8FA"} --채우기 | ||
} | } | ||
2021년 6월 6일 (일) 15:52 판
local p = {}
local table_ = {
width = 400, height = 300,
scales = {}, axes = {}, marks = {}, signals = {}, data = { }
}
table_.data[1] = {
name = "table",
values = {
{category = "USB 3.2 Gen 2x2", amount = 20},
{category = "USB 3.2 Gen 2(구 명칭 USB 3.1 Gen2, USB 3.1)", amount = 10},
{category = "USB 3.2 Gen 1(구 명칭 USB 3.1 Gen 1, USB 3.0) ", amount = 5},
{category = "USB 2.0", amount = 0.480},
{category = "USB 1.0", amount = 0.12}
}
--[[
local i = 1
while values[i] do
values.category = args[i..'이름']
values.amount = args[i..'수치']
i = i + 1
end
]]
}
table_.signals[1] = {}
table_.signals[1].name = "tooltip"
table_.signals[1].value = {}
table_.signals[1].on = {
{events = "rect:mouseover", update = "datum"},
{events = "rect:mouseout", update = "{}"}
}
table_.scales[1] = {}
table_.scales[1].name = "x"
table_.scales[1].range = "width"
table_.scales[1].domain = {data = "table", field = "amount"}
table_.scales[1].round = true
table_.scales[2] = {}
table_.scales[2].name = "y"
table_.scales[2].range = "height"
table_.scales[2].type = "ordinal"
table_.scales[2].domain = {data = "table", field = "category"}
table_.scales[2].padding = 0.3
table_.scales[2].round = true
table_.axes[1] = {type = "x", scale = "x", title = "Gbps" } --축 이름
table_.axes[2] = {type = "y", scale = "y", title = "" } --축 이름
table_.marks[1] = {}
table_.marks[1].type = "rect" --타입
table_.marks[1].from = {data = "table"}
table_.marks[1].properties = {}
table_.marks[1].properties.enter = {
y = {scale = "y", field = "category"},
height = {scale = "y", band = true},
x = {scale = "x", value = 0},
x2 = {scale = "x", field = "amount"}
}
table_.marks[1].properties.update = {
fill = {value = "#4188F1"}
}
table_.marks[1].properties.hover = {
strokeWidth = {value = 1}, --선 두께
stroke = {value = "#4188F1"}, --스트로크
fill = {value = "#F5F8FA"} --채우기
}
function p.jsonDecode()
return 0
--mw.text.jsonDecode()
end
function p.jsonEncode()
return mw.text.jsonEncode(table_)
end
function p.textDecode(frame)
return mw.text.decode(frame.args[1])
end
function p.textSplit(frame)
return mw.text.split(frame.args[1], frame.args[2], frame.args[3] or "")
end
local vertical_p = {}
function vertical_p.main(frame)
local str = ""
local i, j = 1, 1
while frame.args[i] do
str = str..[[<div class="vertical_p" style="float:left;">]]..frame.args[i]..[[ < / div > ]]
i = i + 1
end
return str
end
--return vertical_p
return p