-
Notifications
You must be signed in to change notification settings - Fork 6
Enumerator
let geminiSpec = {
...
"enumerators": [
{
"name": "enumeratorName",
"filter": "the_name_of_the_filter",
"stepSize": stepSize,
// or
"values": [ ... ]
},
...
]
}
Users can specify the enumerator for the steps so that the steps visit multiple states(/stops) of the chart enumerated by replacing the referred filter's value. For example, when interpolating a scatter plot of data from 1990 to 2019, an enumerator can make it visit every intermediate year.
Property | Type | Description |
---|---|---|
name |
String | The identifier to be referred from the interpolate steps. |
filter |
String | The name of the Vega's filter object that is included in both start and end visualization specs. It will enumerate the literal value in the right hand side of the filter.expr . |
stepSize |
Number | When the filter's value is numeric, it enumerates the value with this step. |
values |
Array | Enumerating values for the filter it should include the start and end values. |
There are two ways to apply enumerator. Here are examples.
let spec = {
"timeline": [
{
"component": {"mark": "marks"},
"timing": {"duration": 1000},
"enumerator": "alongYears"
}
],
"enumerators": [ {"name": "alongYears", "filter": "year", "stepSize": 1} ]
}
Enumerator can be referred in a single step. In this case, it enumerates the data changes and interpolate with the timing info of the step.
let spec = {
"timeline": [
{
"concat": [
{
"component": {"mark": "marks"},
"change": {"scale": false}, // change the data only
"timing": {"duration": 1000}
},
{
"component": {"mark": "marks"},
"change": {"data": false}, // change the scale only
"timing": {"duration": 1000}
}
],
"enumerator": "alongYears"
}
],
"enumerators": [ {"name": "alongYears", "filter": "year", "stepSize": 1} ]
}
Enumerator can be referred in a concat block. In this case, it enumerates the steps of the concat to show each data change and concatenates the set of the steps. Each enumerated step follows the timing of the original steps but with divding the durations and delays by the number of the enumeration so that they occupy the same duration.