Struct vega_lite::MarkPropDefWithCondition
source · pub struct MarkPropDefWithCondition {
pub aggregate: Option<AggregateOp>,
pub bin: Option<Bin>,
pub condition: Option<ColorCondition>,
pub field: Option<Field>,
pub legend: Option<Legend>,
pub scale: Option<Scale>,
pub sort: Option<Sort>,
pub time_unit: Option<TimeUnit>,
pub title: Option<String>,
pub mark_prop_def_with_condition_type: Option<Type>,
pub value: Option<PurpleValue>,
}
Expand description
Color of the marks – either fill or stroke color based on the filled
property of mark
definition.
By default, color
represents fill color for "area"
, "bar"
, "tick"
,
"text"
, "trail"
, "circle"
, and "square"
/ stroke color for "line"
and
"point"
.
Default value: If undefined, the default color depends on mark
config’s color
property.
Note:
- For fine-grained control over both fill and stroke colors of the marks, please use the
fill
andstroke
channels. If eitherfill
orstroke
channel is specified,color
channel will be ignored. - See the scale documentation for more information about customizing color scheme.
Fill color of the marks.
Default value: If undefined, the default color depends on mark
config’s color
property.
Note: When using fill
channel, color
channel will be ignored. To customize both
fill and stroke, please use fill
and stroke
channels (not fill
and color
).
Opacity of the marks – either can be a value or a range.
Default value: If undefined, the default opacity depends on mark
config’s opacity
property.
For point
marks the supported values are
"circle"
(default), "square"
, "cross"
, "diamond"
, "triangle-up"
,
or "triangle-down"
, or else a custom SVG path string.
For geoshape
marks it should be a field definition of the geojson data
Default value: If undefined, the default shape depends on mark
config’s shape
property.
Size of the mark.
- For
"point"
,"square"
and"circle"
, – the symbol size, or pixel area of the mark. - For
"bar"
and"tick"
– the bar and tick’s size. - For
"text"
– the text’s font size. - Size is unsupported for
"line"
,"area"
, and"rect"
. (Use"trail"
instead of line with varying size)
Stroke color of the marks.
Default value: If undefined, the default color depends on mark
config’s color
property.
Note: When using stroke
channel, color
channel will be ignored. To customize both
stroke and fill, please use stroke
and fill
channels (not stroke
and color
).
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<ColorCondition>
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
.
legend: Option<Legend>
An object defining properties of the legend.
If null
, the legend for the encoding channel will be removed.
Default value: If undefined, default legend properties are applied.
scale: Option<Scale>
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If null
, the scale will be disabled and the data value will be directly
encoded.
Default value: If undefined, default scale properties are applied.
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.
mark_prop_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.