Skip to content

Instantly share code, notes, and snippets.

@jackcompton
Created March 10, 2015 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackcompton/86d748edd84b16036cb4 to your computer and use it in GitHub Desktop.
Save jackcompton/86d748edd84b16036cb4 to your computer and use it in GitHub Desktop.
//data option 1
// hierarchy is native to the representation
data = [{name: "Country",
value: "Chile",
children: [{name: "series",
value: "Adult Literacy",
columns: [{name: "2001", value: "23"}, {name: "2002", value: "29"}]
},
{name: "series",
value: "Fully Vaccinated",
columns: [{name: "2001", value: "12"}, {name: "2002", value: "15"}]
}]
}]
//data option 2:
// data itself is stored hierarchy agnostic. hierarchical grouping (if needed) must be provided separately
data = [
[{dimensions: {"Country": "Chile", "Series": "Adult Literacy", "Year": 2001}, value: 23},
{dimensions: {"Country": "Chile", "Series": "Adult Literacy", "Year": 2002}, value: 29},
{dimensions: {"Country": "Chile", "Series": "Fully Vaccinated", "Year": 2001}, value: 12},
{dimensions: {"Country": "Chile", "Series": "Fully Vaccinated", "Year": 2002}, value: 15}]
]
structure = {rows: ["Country", "Series"], columns: "Year"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment