Struct vega_lite::Def

source ·
pub struct Def {
    pub aggregate: Option<AggregateOp>,
    pub bin: Option<Bin>,
    pub field: Option<Field>,
    pub sort: Option<VgComparatorOrder>,
    pub time_unit: Option<TimeUnit>,
    pub title: Option<String>,
    pub def_type: Option<Type>,
    pub value: Option<PurpleValue>,
}
Expand description

Definition object for a constant value of an encoding channel.

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.

§sort: Option<VgComparatorOrder>

The sort order. One of "ascending" (default) or "descending".

§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:

  1. You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.

  2. If both field definition’s title and axis, header, or legend title are defined, axis/header/legend title will be used.

§def_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 (e.g., "red" / “#0099ff” for color, values between 0 to 1 for opacity).

Trait Implementations§

Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.