Norway Pyramid (example)
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <script src="http://json-stat.org/lib/json-stat.js"></script> <link rel="stylesheet" href="http://idescat.github.io/visual/visual.css" /> <script src="http://idescat.github.io/visual/lazyvisualsetup.js"></script> </head> <body> <div id="visual" class="visual"></div> <script> url="http://data.ssb.no/api/v0/dataset/1082.json?lang=en"; function main(obj){ ds=JSONstat(obj).Dataset(0); t=ds.Dimension("Tid").length-1; year=ds.Dimension("Tid").id[t]; //Pyramid visual({ lang: "en", type: "pyram", title: ds.label, footer: ds.source, time: ds.Dimension("Tid").Category(t).label, by: ds.Dimension("Alder", false), data: [ { label: ds.Dimension("Kjonn").Category("1").label, val: ds.Data({"Kjonn": "1", "Tid": year}, false) }, { label: ds.Dimension("Kjonn").Category("2").label, val: ds.Data({"Kjonn": "2", "Tid": year}, false) } ] }); } GET(url, main); function GET(url, main){ fetch( url ) .then(function(resp) { resp.json().then(main); }) ; } </script> </body> </html>
Presentation and Programme
Templates and Examples (Browser supporting Fetch required. For example, Google Chrome)
Bar Chart (template) Pyramid (template) Line Chart (template) Map (template) jQuery Post (template) Async JSONstat (template) Responsive Iframe (template) Sweden Bar (example) Norway Pyramid (example) Denmark Pyramid (example) Finland Bar (example) Greenland Pyramid (example) Faroe Islands Pyramid (example) Iceland Line (example) Norway Map (example)