Struct vega_lite::FacetFieldDef
source · pub struct FacetFieldDef {
pub aggregate: Option<AggregateOp>,
pub bin: Option<Bin>,
pub field: Option<Field>,
pub header: Option<Header>,
pub sort: Option<Sort>,
pub time_unit: Option<TimeUnit>,
pub title: Option<String>,
pub facet_field_def_type: Type,
}
Expand description
Horizontal facets for trellis plots.
Vertical facets for trellis plots.
Fields§
§aggregate: Option<AggregateOp>
Aggregation function for the field
(e.g., mean
, sum
, median
, min
, max
, count
).
Default value: undefined
(None)
bin: Option<Bin>
A flag for binning a quantitative
field, or an object defining binning
parameters.
If true
, default binning parameters
will be applied.
Default value: false
field: Option<Field>
Required. A string defining the name of the field from which to pull a data value
or an object defining iterated values from the
repeat
operator.
Note: Dots (.
) and brackets ([
and ]
) can be used to access nested objects
(e.g., "field": "foo.bar"
and "field": "foo['bar']"
).
If field names contain dots or brackets but are not nested, you can use \\
to escape
dots and brackets (e.g., "a\\.b"
and "a\\[0\\]"
).
See more details about escaping in the field
documentation.
Note: field
is not required if aggregate
is count
.
header: Option<Header>
An object defining properties of a facet’s header.
sort: Option<Sort>
Sort order for the encoded field.
For continuous fields (quantitative or temporal), sort
can be either "ascending"
or
"descending"
.
For discrete fields, sort
can be one of the following:
"ascending"
or"descending"
– for sorting by the values’ natural order in Javascript.- A sort field definition for sorting by another field.
- An array specifying the field values in preferred
order. In this case, the
sort order will obey the values in the array, followed by any unspecified values in their
original order. For discrete time field, values in the sort array can be date-time
definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value: "ascending"
Note: null
is not supported for row
and column
.
time_unit: Option<TimeUnit>
Time unit (e.g., year
, yearmonth
, month
, hours
) for a temporal field.
or a temporal field that gets casted as
ordinal.
Default value: undefined
(None)
title: Option<String>
A title for the field. If null
, the title will be removed.
Default value: derived from the field’s name and transformation function
(aggregate
, bin
and timeUnit
). If the field has an aggregate function, the
function is displayed as part of the title (e.g., "Sum of Profit"
). If the field is
binned or has a time unit applied, the applied function is shown in parentheses (e.g.,
"Profit (binned)"
, "Transaction Date (year-month)"
). Otherwise, the title is simply
the field name.
Notes:
-
You can customize the default field title format by providing the [
fieldTitle
property in the config orfieldTitle
function via thecompile
function’s options. -
If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
facet_field_def_type: Type
The encoded field’s type of measurement ("quantitative"
, "temporal"
, "ordinal"
, or
"nominal"
).
It can also be a "geojson"
type for encoding
‘geoshape’.