Class Predicate
- a Vega expression string, where datum can be used to refer to the current data object. For example, datum.b2 > 60 would test if the value in the field b2 for each data point is over 60.
- one of the field predicates: equal, lt, lte, gt, gte, range, oneOf, or valid.
- a parameter predicate, which defines the names of a selection that the data point should belong to (or a logical composition of selections).
- a logical composition of (1), (2), or (3).
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Predicate
Logical AND composition to combine predicates.static Predicate
Logical NOT operation.static Predicate
Test if a field in the data point satisfies certain conditions.static Predicate
Test if a field in the data point satisfies certain conditions.static Predicate
Test if a field in the data point satisfies certain conditions.static Predicate
Test if a field in the data point satisfies certain conditions.static Predicate
Test if a field in the data point satisfies certain conditions.static Predicate
Logical OR composition to combine predicates.static Predicate
Test if a field in the data point satisfies certain conditions.Sets the time unit for a temporal field.static Predicate
Test if a field is valid, meaning it is neither null nor NaN.
-
Constructor Details
-
Predicate
Constructor.- Parameters:
expr
- a Vega expression string.
-
Predicate
Constructor of parameter predicate. For example, with {"param": "brush"}, only data values that fall within the selection named brush will remain in the dataset. Notice, by default, empty selections are considered to contain all data values. We can toggle this behavior by setting the optional empty property true on the predicate.- Parameters:
param
- Filter using a parameter name.empty
- For selection parameters, the predicate of empty selections returns true by default. Override this behavior, by setting this property false.
-
-
Method Details
-
timeUnit
Sets the time unit for a temporal field. Vega-Lite supports the following time units:"year" - Gregorian calendar years. "quarter" - Three-month intervals, starting in one of January, April, July, and October. "month" - Calendar months (January, February, etc.). "date" - Calendar day of the month (January 1, January 2, etc.). "week" - Sunday-based weeks. Days before the first Sunday of the year are considered to be in week 0, the first Sunday of the year is the start of week 1, the second Sunday week 2, etc. "day" - Day of the week (Sunday, Monday, etc.). "dayofyear" - Day of the year (1, 2, …, 365, etc.). "hours" - Hours of the day (12:00am, 1:00am, etc.). "minutes" - Minutes in an hour (12:00, 12:01, etc.). "seconds" - Seconds in a minute (12:00:00, 12:00:01, etc.). "milliseconds" - Milliseconds in a second.
- Parameters:
timeUnit
- Time unit.- Returns:
- this object.
-
of
Test if a field in the data point satisfies certain conditions.- Parameters:
field
- the field to be tested.op
- equal, lt (less than), lte (less than or equal), gt (greater than), or gte(greater than or equal).value
- the value to compare.- Returns:
- a field predicate.
-
of
Test if a field in the data point satisfies certain conditions.- Parameters:
field
- the field to be tested.op
- equal, lt (less than), lte (less than or equal), gt (greater than), or gte(greater than or equal).value
- the value to compare.- Returns:
- a field predicate.
-
of
Test if a field in the data point satisfies certain conditions.- Parameters:
field
- the field to be tested.op
- equal, lt (less than), lte (less than or equal), gt (greater than), or gte(greater than or equal).value
- the value to compare.- Returns:
- a field predicate.
-
range
Test if a field in the data point satisfies certain conditions.- Parameters:
field
- the field to be tested.min
- inclusive minimum values for a field value of a data item to be included in the filtered data.max
- inclusive maximum values for a field value of a data item to be included in the filtered data.- Returns:
- a field predicate.
-
oneOf
Test if a field in the data point satisfies certain conditions.- Parameters:
field
- the field to be tested.values
- a set of values that the field's value should be a member of, for a data item included in the filtered data.- Returns:
- a field predicate.
-
oneOf
Test if a field in the data point satisfies certain conditions.- Parameters:
field
- the field to be tested.values
- a set of values that the field's value should be a member of, for a data item included in the filtered data.- Returns:
- a field predicate.
-
valid
Test if a field is valid, meaning it is neither null nor NaN.- Parameters:
field
- the field to be tested.- Returns:
- a field predicate.
-
and
Logical AND composition to combine predicates.- Parameters:
predicates
- the predicates.- Returns:
- AND predicate.
-
or
Logical OR composition to combine predicates.- Parameters:
predicates
- the predicates.- Returns:
- OR predicate.
-
not
Logical NOT operation.- Parameters:
predicate
- the predicate.- Returns:
- NOT predicate.
-