pub struct TextFieldDef {
pub aggregate: Option<AggregateOp>,
pub bin: Option<Bin>,
pub field: Option<Field>,
pub format: Option<String>,
pub time_unit: Option<TimeUnit>,
pub title: Option<String>,
pub text_field_def_type: Type,
}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.
format: Option<String>The formatting pattern for a text field. If not defined, this will be determined automatically.
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 [
fieldTitleproperty in the config orfieldTitlefunction via thecompilefunction’s options. -
If both field definition’s
titleand axis, header, or legendtitleare defined, axis/header/legend title will be used.
text_field_def_type: TypeThe encoded field’s type of measurement ("quantitative", "temporal", "ordinal", or
"nominal").
It can also be a "geojson" type for encoding
‘geoshape’.