Speedway

Module:Sandbox/Aude/PopulationChart

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