-
Notifications
You must be signed in to change notification settings - Fork 474
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. Furthermore, data points whose y-accessor values are null will also be considered missing.
Possible values: {false, true}
# missing_is_hidden_accessor
When missing_is_hidden is enabled and missing_is_hidden_accessor is set, not only will ranges for which there is no data be hidden, but also data points that have been identified in the data source as missing, which is to say, those that have a missing_is_hidden_accessor attribute that's set to true. Note that data points with null y-accessors are hidden as well.
Possible values: {null, string}
# utc_time
Determines whether to use a local time formatter (d3.time.format) or a UTC time formatter (d3.time.format.utc) when the data is a time-series. The option is available as of v2.7.
Possible values: {false, true}
# x_accessor
The name of the element in the data object that is to be considered the x-accessor.
Possible values: {'date', string}
# x_sort
Determines whether to sort the x-axis' values.
Possible values: {true, false}
# 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]}