Module:Sandbox/Aude/PopulationChart

This is the current revision of this page, as edited by imported>Yurik at 16:15, 15 December 2015 (updated to vega2.0 mw:Extension:Graph/Vega_2.0). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

local json = {
	version = 2,
	width = 400,
	height = 200,
	data = {
		{
			name = "table",
			values = {}
		}
	},
	scales = {
		{
			name = "x",
			type = "ordinal",
			range = "width",
			domain = { data = "table", field= "x" }
		},
		{
			name = "y",
			range = "height",
			nice = true,
			domain = { data = "table", field = "y" }
		}
	}
}

function p.main(frame)
	return tostring(mw.html.create("div")
		:css("border", "solid 1px #000")
		:wikitext(mw.getCurrentFrame():extensionTag("graph", mw.text.jsonEncode(json)))
	)
end

return p