Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Table graph
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function p.main(frame) local frame = mw.getCurrentFrame() local chart = frame:getParent().args[1]:lower():gsub('%s*(.+)%s*','%1') local pagename = frame.args[2] or '' local table_id = frame.args[3] or '' local source = '' local data = '' local first = frame.args['first'] local count = 0 if pagename == '' then source = frame:getParent():getTitle():getContent() else source = mw.title.new(pagename):getContent() end if table_id ~= '' then source = source:match('{|.-id -="?'..table_id..'"? -.-(\n|%-.+\n)|}') end for x, y in source:gmatch('\n|%-.-\n[!|]%s*(.-)%s*[|\n]|%s*([^|\n]+)') do count = count + 1 data = data.."("..y..":"..x..")\n" if count == first then return require('Module:Chart')[chart](frame) end end if frame:getParent().args['debug'] then return string.format(' chart: '..chart..'\n pagename: '..pagename..'\n table: '..table_id..'\n data: ' .. data) else if chart == 'pie chart' then frame.args.slices = data end return require('Module:Chart')[chart](frame) end end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:Sandbox other
(
edit
)
Template:Tlx
(
edit
)
Module:Arguments
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:String
(
edit
)
Module:Table graph/doc
(
edit
)
Module:Template link general
(
edit
)
Module:Yesno
(
edit
)