Struct vega_lite::DefWithCondition
source · pub struct DefWithCondition {
pub aggregate: Option<AggregateOp>,
pub bin: Option<Bin>,
pub condition: Option<HrefCondition>,
pub field: Option<Field>,
pub time_unit: Option<TimeUnit>,
pub title: Option<String>,
pub def_with_condition_type: Option<Type>,
pub value: Option<PurpleValue>,
}
Expand description
A URL to load upon mouse click.
A FieldDef with Condition
A ValueDef with Condition<ValueDef | FieldDef> { condition: {field: …} | {value: …}, value: …, }
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
condition: Option<HrefCondition>
One or more value definition(s) with a selection predicate.
Note: A field definition’s condition
property can only contain value
definitions
since Vega-Lite only allows at most one encoded field per encoding channel.
A field definition or one or more value definition(s) with a selection predicate.
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
.
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.
def_with_condition_type: Option<Type>
The encoded field’s type of measurement ("quantitative"
, "temporal"
, "ordinal"
, or
"nominal"
).
It can also be a "geojson"
type for encoding
‘geoshape’.
value: Option<PurpleValue>
A constant value in visual domain.