Struct vega_lite_4::AxisConfig
source · pub struct AxisConfig {Show 79 fields
pub aria: Option<Aria>,
pub band_position: Option<CornerRadiusUnion>,
pub description: Option<Box<Color>>,
pub disable: Option<bool>,
pub domain: Option<Aria>,
pub domain_cap: Option<Cap>,
pub domain_color: Option<Box<Color>>,
pub domain_dash: Option<StrokeDashUnion>,
pub domain_dash_offset: Option<CornerRadiusUnion>,
pub domain_opacity: Option<CornerRadiusUnion>,
pub domain_width: Option<CornerRadiusUnion>,
pub format: Option<Format>,
pub format_type: Option<String>,
pub grid: Option<bool>,
pub grid_cap: Option<Cap>,
pub grid_color: Option<GridColorUnion>,
pub grid_dash: Option<AxisBandGridDash>,
pub grid_dash_offset: Option<GridDashOffsetUnion>,
pub grid_opacity: Option<GridOpacityUnion>,
pub grid_width: Option<GridWidthUnion>,
pub label_align: Option<ConditionalAxisPropertyAlignNull>,
pub label_angle: Option<LabelAngle>,
pub label_baseline: Option<PurpleTextBaseline>,
pub label_bound: Option<Label>,
pub label_color: Option<GridColorUnion>,
pub label_expr: Option<String>,
pub label_flush: Option<LabelFlush>,
pub label_flush_offset: Option<CornerRadiusUnion>,
pub label_font: Option<ConditionalAxisPropertyStringNull>,
pub label_font_size: Option<GridWidthUnion>,
pub label_font_style: Option<ConditionalAxisPropertyFontStyleNull>,
pub label_font_weight: Option<FontWeight>,
pub label_limit: Option<CornerRadiusUnion>,
pub label_line_height: Option<CornerRadiusUnion>,
pub label_offset: Option<GridDashOffsetUnion>,
pub label_opacity: Option<GridDashOffsetUnion>,
pub label_overlap: Option<LabelOverlapUnion>,
pub label_padding: Option<GridDashOffsetUnion>,
pub labels: Option<Aria>,
pub label_separation: Option<CornerRadiusUnion>,
pub max_extent: Option<CornerRadiusUnion>,
pub min_extent: Option<CornerRadiusUnion>,
pub offset: Option<f64>,
pub orient: Option<TitleOrientUnion>,
pub position: Option<CornerRadiusUnion>,
pub style: Option<LegendText>,
pub tick_band: Option<TickBandUnion>,
pub tick_cap: Option<Cap>,
pub tick_color: Option<GridColorUnion>,
pub tick_count: Option<TickCount>,
pub tick_dash: Option<AxisBandTickDash>,
pub tick_dash_offset: Option<GridDashOffsetUnion>,
pub tick_extra: Option<Aria>,
pub tick_min_step: Option<CornerRadiusUnion>,
pub tick_offset: Option<CornerRadiusUnion>,
pub tick_opacity: Option<GridDashOffsetUnion>,
pub tick_round: Option<Aria>,
pub ticks: Option<Aria>,
pub tick_size: Option<GridWidthUnion>,
pub tick_width: Option<GridWidthUnion>,
pub title: RemovableValue<LegendText>,
pub title_align: Option<TitleAlignUnion>,
pub title_anchor: Option<TitleAnchorUnion>,
pub title_angle: Option<CornerRadiusUnion>,
pub title_baseline: Option<TextBaseline>,
pub title_color: Option<Box<Color>>,
pub title_font: Option<Box<Color>>,
pub title_font_size: Option<FontSize>,
pub title_font_style: Option<Box<Color>>,
pub title_font_weight: Option<FontWeightUnion>,
pub title_limit: Option<FontSize>,
pub title_line_height: Option<CornerRadiusUnion>,
pub title_opacity: Option<CornerRadiusUnion>,
pub title_padding: Option<CornerRadiusUnion>,
pub title_x: Option<CornerRadiusUnion>,
pub title_y: Option<CornerRadiusUnion>,
pub translate: Option<CornerRadiusUnion>,
pub values: Option<Values>,
pub zindex: Option<f64>,
}
Expand description
Axis configuration, which determines default properties for all x
and y
axes. For a full list of axis
configuration options, please see the corresponding section of the axis
documentation.
Config for axes with “band” scales.
Config for x-axis along the bottom edge of the chart.
Config for axes with “point” or “band” scales.
Config for y-axis along the left edge of the chart.
Config for axes with “point” scales.
Config for quantitative axes.
Config for y-axis along the right edge of the chart.
Config for temporal axes.
Config for x-axis along the top edge of the chart.
X-axis specific config.
Config for x-axes with “band” scales.
Config for x-axes with “point” or “band” scales.
Config for x-axes with “point” scales.
Config for x-quantitative axes.
Config for x-temporal axes.
Y-axis specific config.
Config for y-axes with “band” scales.
Config for y-axes with “point” or “band” scales.
Config for y-axes with “point” scales.
Config for y-quantitative axes.
Config for y-temporal axes.
Fields§
§aria: Option<Aria>
§band_position: Option<CornerRadiusUnion>
§description: Option<Box<Color>>
§disable: Option<bool>
Disable axis by default.
domain: Option<Aria>
§domain_cap: Option<Cap>
§domain_color: Option<Box<Color>>
§domain_dash: Option<StrokeDashUnion>
§domain_dash_offset: Option<CornerRadiusUnion>
§domain_opacity: Option<CornerRadiusUnion>
§domain_width: Option<CornerRadiusUnion>
§format: Option<Format>
When used with the default "number"
and "time"
format type, the text formatting
pattern for labels of guides (axes, legends, headers) and text marks.
- If the format type is
"number"
(e.g., for quantitative fields), this is D3’s number format pattern. - If the format type is"time"
(e.g., for temporal fields), this is D3’s time format pattern.
See the format documentation for more examples.
When used with a custom
formatType
, this
value will be passed as format
alongside datum.value
to the registered function.
Default value: Derived from numberFormat config for number format and from timeFormat config for time format.
format_type: Option<String>
The format type for labels. One of "number"
, "time"
, or a registered custom format
type.
Default value: - "time"
for temporal fields and ordinal and nominal fields with
timeUnit
. - "number"
for quantitative fields as well as ordinal and nominal fields
without timeUnit
.
grid: Option<bool>
A boolean flag indicating if grid lines should be included as part of the axis
Default value: true
for continuous
scales that are not binned;
otherwise, false
.
grid_cap: Option<Cap>
§grid_color: Option<GridColorUnion>
§grid_dash: Option<AxisBandGridDash>
§grid_dash_offset: Option<GridDashOffsetUnion>
§grid_opacity: Option<GridOpacityUnion>
§grid_width: Option<GridWidthUnion>
§label_align: Option<ConditionalAxisPropertyAlignNull>
§label_angle: Option<LabelAngle>
§label_baseline: Option<PurpleTextBaseline>
§label_bound: Option<Label>
§label_color: Option<GridColorUnion>
§label_expr: Option<String>
Vega expression for customizing labels text.
Note: The label text and value can be assessed via the label
and value
properties
of the axis’s backing datum
object.
label_flush: Option<LabelFlush>
Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.
Default value: true
for axis of a continuous x-scale. Otherwise, false
.
label_flush_offset: Option<CornerRadiusUnion>
§label_font: Option<ConditionalAxisPropertyStringNull>
§label_font_size: Option<GridWidthUnion>
§label_font_style: Option<ConditionalAxisPropertyFontStyleNull>
§label_font_weight: Option<FontWeight>
§label_limit: Option<CornerRadiusUnion>
§label_line_height: Option<CornerRadiusUnion>
§label_offset: Option<GridDashOffsetUnion>
§label_opacity: Option<GridDashOffsetUnion>
§label_overlap: Option<LabelOverlapUnion>
The strategy to use for resolving overlap of axis labels. If false
(the default), no
overlap reduction is attempted. If set to true
or "parity"
, a strategy of removing
every other label is used (this works well for standard linear axes). If set to
"greedy"
, a linear scan of the labels is performed, removing any labels that overlaps
with the last visible label (this often works better for log-scaled axes).
Default value: true
for non-nominal fields with non-log scales; "greedy"
for log
scales; otherwise false
.
label_padding: Option<GridDashOffsetUnion>
§labels: Option<Aria>
§label_separation: Option<CornerRadiusUnion>
§max_extent: Option<CornerRadiusUnion>
§min_extent: Option<CornerRadiusUnion>
§offset: Option<f64>
The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.
Default value: derived from the axis
config’s offset
(0
by default)
orient: Option<TitleOrientUnion>
The orientation of the axis. One of "top"
, "bottom"
, "left"
or "right"
. The
orientation can be used to further specialize the axis type (e.g., a y-axis oriented
towards the right edge of the chart).
Default value: "bottom"
for x-axes and "left"
for y-axes.
position: Option<CornerRadiusUnion>
The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate.
Default value: 0
style: Option<LegendText>
A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the style configuration. If style is an array, later styles will override earlier styles.
Default value: (none) Note: Any specified style will augment the default style.
For example, an x-axis mark with "style": "foo"
will use config.axisX
and
config.style.foo
(the specified style "foo"
has higher precedence).
tick_band: Option<TickBandUnion>
§tick_cap: Option<Cap>
§tick_color: Option<GridColorUnion>
§tick_count: Option<TickCount>
A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are “nice” (multiples of 2, 5, 10) and lie within the underlying scale’s range.
For scales of type "time"
or "utc"
, the tick count can instead be a time interval
specifier. Legal string values are "millisecond"
, "second"
, "minute"
, "hour"
,
"day"
, "week"
, "month"
, and "year"
. Alternatively, an object-valued interval
specifier of the form {"interval": "month", "step": 3}
includes a desired number of
interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct)
boundary.
Default value: Determine using a formula ceil(width/40)
for x and ceil(height/40)
for y.
tick_dash: Option<AxisBandTickDash>
§tick_dash_offset: Option<GridDashOffsetUnion>
§tick_extra: Option<Aria>
§tick_min_step: Option<CornerRadiusUnion>
The minimum desired step between axis ticks, in terms of scale domain values. For
example, a value of 1
indicates that ticks should not be less than 1 unit apart. If
tickMinStep
is specified, the tickCount
value will be adjusted, if necessary, to
enforce the minimum step value.
tick_offset: Option<CornerRadiusUnion>
§tick_opacity: Option<GridDashOffsetUnion>
§tick_round: Option<Aria>
§ticks: Option<Aria>
§tick_size: Option<GridWidthUnion>
§tick_width: Option<GridWidthUnion>
§title: RemovableValue<LegendText>
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.
title_align: Option<TitleAlignUnion>
§title_anchor: Option<TitleAnchorUnion>
§title_angle: Option<CornerRadiusUnion>
§title_baseline: Option<TextBaseline>
§title_color: Option<Box<Color>>
§title_font: Option<Box<Color>>
§title_font_size: Option<FontSize>
§title_font_style: Option<Box<Color>>
§title_font_weight: Option<FontWeightUnion>
§title_limit: Option<FontSize>
§title_line_height: Option<CornerRadiusUnion>
§title_opacity: Option<CornerRadiusUnion>
§title_padding: Option<CornerRadiusUnion>
§title_x: Option<CornerRadiusUnion>
§title_y: Option<CornerRadiusUnion>
§translate: Option<CornerRadiusUnion>
§values: Option<Values>
Explicitly set the visible axis tick values.
zindex: Option<f64>
A non-negative integer indicating the z-index of the axis. If zindex is 0, axes should be
drawn behind all chart elements. To put them in front, set zindex
to 1
or more.
Default value: 0
(behind the marks).
Trait Implementations§
source§impl Clone for AxisConfig
impl Clone for AxisConfig
source§fn clone(&self) -> AxisConfig
fn clone(&self) -> AxisConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more