pub struct Encoding {Show 22 fields
pub color: Option<MarkPropDefWithCondition>,
pub column: Option<FacetFieldDef>,
pub detail: Option<Detail>,
pub fill: Option<MarkPropDefWithCondition>,
pub href: Option<DefWithCondition>,
pub key: Option<FieldDef>,
pub latitude: Option<FieldDef>,
pub latitude2: Option<FieldDef>,
pub longitude: Option<FieldDef>,
pub longitude2: Option<FieldDef>,
pub opacity: Option<MarkPropDefWithCondition>,
pub order: Option<Order>,
pub row: Option<FacetFieldDef>,
pub shape: Option<MarkPropDefWithCondition>,
pub size: Option<MarkPropDefWithCondition>,
pub stroke: Option<MarkPropDefWithCondition>,
pub text: Option<TextClass>,
pub tooltip: Option<Tooltip>,
pub x: Option<XClass>,
pub x2: Option<X2Class>,
pub y: Option<XClass>,
pub y2: Option<X2Class>,
}
Expand description
A key-value mapping between encoding channels and definition of fields.
A shared key-value mapping between encoding channels and definition of fields in the underlying layers.
Fields§
§color: Option<MarkPropDefWithCondition>
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.
column: Option<FacetFieldDef>
Horizontal facets for trellis plots.
detail: Option<Detail>
Additional levels of detail for grouping data in aggregate views and in line, trail, and area marks without mapping data to a specific visual channel.
fill: Option<MarkPropDefWithCondition>
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
).
href: Option<DefWithCondition>
A URL to load upon mouse click.
key: Option<FieldDef>
A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data.
latitude: Option<FieldDef>
Latitude position of geographically projected marks.
latitude2: Option<FieldDef>
Latitude-2 position for geographically projected ranged "area"
, "bar"
, "rect"
, and
"rule"
.
longitude: Option<FieldDef>
Longitude position of geographically projected marks.
longitude2: Option<FieldDef>
Longitude-2 position for geographically projected ranged "area"
, "bar"
, "rect"
,
and "rule"
.
opacity: Option<MarkPropDefWithCondition>
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.
order: Option<Order>
Order of the marks.
- For stacked marks, this
order
channel encodes stack order. - For line and trail marks, this
order
channel encodes order of data points in the lines. This can be useful for creating a connected scatterplot. Settingorder
to{"value": null}
makes the line marks use the original order in the data sources. - Otherwise, this
order
channel encodes layer order of the marks.
Note: In aggregate plots, order
field should be aggregate
d to avoid creating
additional aggregation grouping.
row: Option<FacetFieldDef>
Vertical facets for trellis plots.
shape: Option<MarkPropDefWithCondition>
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: Option<MarkPropDefWithCondition>
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: Option<MarkPropDefWithCondition>
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
).
text: Option<TextClass>
Text of the text
mark.
tooltip: Option<Tooltip>
The tooltip text to show upon mouse hover.
x: Option<XClass>
X coordinates of the marks, or width of horizontal "bar"
and "area"
.
x2: Option<X2Class>
X2 coordinates for ranged "area"
, "bar"
, "rect"
, and "rule"
.
y: Option<XClass>
Y coordinates of the marks, or height of vertical "bar"
and "area"
.
y2: Option<X2Class>
Y2 coordinates for ranged "area"
, "bar"
, "rect"
, and "rule"
.