Struct vega_lite::Axis

source ·
pub struct Axis {
Show 22 fields pub domain: Option<bool>, pub format: Option<String>, pub grid: Option<bool>, pub label_angle: Option<f64>, pub label_bound: Option<Label>, pub label_flush: Option<Label>, pub label_overlap: Option<LabelOverlapUnion>, pub label_padding: Option<f64>, pub labels: Option<bool>, pub max_extent: Option<f64>, pub min_extent: Option<f64>, pub offset: Option<f64>, pub orient: Option<TitleOrient>, pub position: Option<f64>, pub tick_count: Option<f64>, pub ticks: Option<bool>, pub tick_size: Option<f64>, pub title: Option<String>, pub title_max_length: Option<f64>, pub title_padding: Option<f64>, pub values: Option<Vec<SortElement>>, pub zindex: Option<f64>,
}

Fields§

§domain: Option<bool>

A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.

Default value: true

§format: Option<String>

The formatting pattern for labels. This is D3’s number format pattern for quantitative fields and D3’s time format pattern for time field.

See the format documentation for more information.

Default value: derived from numberFormat config for quantitative fields and from timeFormat config for temporal fields.

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

§label_angle: Option<f64>

The rotation angle of the axis labels.

Default value: -90 for nominal and ordinal fields; 0 otherwise.

§label_bound: Option<Label>

Indicates if labels should be hidden if they exceed the axis range. If false (the default) no bounds overlap analysis is performed. If true, labels will be hidden if they exceed the axis range by more than 1 pixel. If this property is a number, it specifies the pixel tolerance: the maximum amount by which a label bounding box may exceed the axis range.

Default value: false.

§label_flush: Option<Label>

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_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<f64>

The padding, in pixels, between axis and text labels.

§labels: Option<bool>

A boolean flag indicating if labels should be included as part of the axis.

Default value: true.

§max_extent: Option<f64>

The maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles.

Default value: undefined.

§min_extent: Option<f64>

The minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles.

Default value: 30 for y-axis; undefined for x-axis.

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

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 for the right edge of the chart).

Default value: "bottom" for x-axes and "left" for y-axes.

§position: Option<f64>

The anchor position of the axis in pixels. For x-axis with top or bottom orientation, this sets the axis group x coordinate. For y-axis with left or right orientation, this sets the axis group y coordinate.

Default value: 0

§tick_count: Option<f64>

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.

§ticks: Option<bool>

Boolean value that determines whether the axis should include ticks.

§tick_size: Option<f64>

The size in pixels of axis ticks.

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

§title_max_length: Option<f64>

Max length for axis title if the title is automatically generated from the field’s description.

§title_padding: Option<f64>

The padding, in pixels, between title and axis.

§values: Option<Vec<SortElement>>

Explicitly set the visible axis tick values.

§zindex: Option<f64>

A non-positive integer indicating z-index of the axis. If zindex is 0, axes should be drawn behind all chart elements. To put them in front, use "zindex = 1".

Default value: 1 (in front of the marks) for actual axis and 0 (behind the marks) for grids.

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.