-
Notifications
You must be signed in to change notification settings - Fork 473
Data
Home ▸ List of Options ▸ Data
# data
The data as an array of objects, for instance
[{'date':new Date('2014-11-01'),'value':12},
{'date':new Date('2014-11-02'),'value':18}]
# missing_is_zero
If true and if the data object is a time series where the unit is no smaller than days, missing data points will be treated as zeros. If any of the data sets in a multi line graph have length of 0, an uncaught type error will be thrown.
Possible values: {false, true}
# missing_is_hidden
If true and if the data object is a time series where the unit is no smaller than days, missing data points will shown as broken line segments. If any of the data sets in a multi line graph have length of 0, an uncaught type error will be thrown.
Possible values: {false, true}
# missing_is_hidden_accessor
The name of the element in the data object that determines whether missing_is_hidden triggers. Requires missing_is_hidden=true to function.
Possible values: {'missing', string}
# x_accessor
The name of the element in the data object that is to be considered the x-accessor.
Possible values: {'date', string}
# y_accessor
The name of the element in the data object that is to be considered the y-accessor. Optionally, one can specify an array of accessor names in order to build a multi-line chart. This is useful when the data object looks like this:
[
{
"date":new Date('2014-11-01'),
"downloads_windows":12552216,
"downloads_mac":2271801
},
{
"date":new Date('2014-11-02'),
"downloads_windows":13451892,
"downloads_mac":2325732
}
]
In which case, y_accessor
is specified as so:
MG.data_graphic({
...
x_accessor: date,
y_accessor: ['downloads_windows', 'downloads_mac']
});
Note that the other way to build a multi-line chart is to have a data object that is an array of arrays. MetricsGraphics will plot each array as a separate line, using the specified y_accessor
. For instance, given the data file:
[
[
{
"date":new Date('2014-11-01'),
"value":150000000
},
{
"date":new Date('2014-11-02'),
"value":168799730
}
],
[
{
"date":new Date('2014-11-01'),
"value": 10000000
},
{
"date":new Date('2014-11-02'),
"value": 18799730
}
]
]
One would plot it, like so:
MG.data_graphic({
...
x_accessor: date,
y_accessor: value
});
Possible values: {'value', string, [string]}