forked from lineupjs/lineupjs
-
Notifications
You must be signed in to change notification settings - Fork 4
Data Format
Samuel Gratzl edited this page Sep 1, 2014
·
3 revisions
LineUp.js uses a simple JSON description file for loading and interpreting tabular data.
example: data_small.json
{
"file": "wur2013.txt",
"separator" : "\t",
"primaryKey": "schoolname",
"columns": [
{
"column": "schoolname",
"type": "string"
},
{
"column": "academic",
"type": "number",
"domain": [0, 100]
},
{
"column": "internationalstudents",
"label": "international students",
"type": "number",
"domain": [0, 100]
}
],
"layout": {
"primary": [
{
"column": "schoolname",
"width": 200
},
{
"column": "academic",
"width": 100
},
{
"type": "stacked",
"label": "Combined",
"children": [
{
"column": "academic",
"width": 100
},
{
"column": "internationalstudents",
"width": 150
}
]
},
]
}
}
entries:
-
file
,url
,data
: data reference -
file
: name of the file, which is a given relative to the current descriptor file -
url
: url of the data file to load -
data
: in case the data are part of this description as array of objects -
separator
: the separator to use for parsing the comma separated file, default\t
-
primaryKey
: name of the column, which provides unique row ids for this dataset -
columns
: list of columns in the data along with meta data about them -
layout
: collection of layouts, how the described columns are combined and layouted in LineUp. In the current version only theprimary
layout is supported.
A column description consists of the column name
as well as the type
of the column. Optionally, a label
can be provided. By default, the column name is used.
LineUp.js currently supports following column types:
string
-
number
: Besides the type, the description requires: -
domain
: the domain of this number column, the value is used to initialize a D3 Linear Scale -
range
(optional, default:[0,1]
): similar to thedomain
the range of the linear scale can be defined
Layout columns are used to specify the LineUp.js frontend layout. Besides the width
of the column given in pixel, following different types
are supported:
-
single
[default]: requires an additionalcolumn
attribute, containing the column name to display -
rank
: a simple rank column, showing the rank of each row -
combined
: a stacked column, which requires to specify itschildren
as columns. The weights are automatically computed from the distribution of column widths.