[][src]Struct vega_lite_3::Axis

pub struct Axis {
    pub band_position: Option<f64>,
    pub domain: Option<bool>,
    pub domain_color: Option<String>,
    pub domain_dash: Option<Vec<f64>>,
    pub domain_dash_offset: Option<f64>,
    pub domain_opacity: Option<f64>,
    pub domain_width: Option<f64>,
    pub format: Option<String>,
    pub format_type: Option<FormatType>,
    pub grid: Option<bool>,
    pub grid_color: Option<String>,
    pub grid_dash: Option<Vec<f64>>,
    pub grid_dash_offset: Option<f64>,
    pub grid_opacity: Option<f64>,
    pub grid_width: Option<f64>,
    pub label_align: Option<Align>,
    pub label_angle: Option<f64>,
    pub label_baseline: Option<TextBaseline>,
    pub label_bound: Option<Label>,
    pub label_color: Option<String>,
    pub label_flush: Option<Label>,
    pub label_flush_offset: Option<f64>,
    pub label_font: Option<String>,
    pub label_font_size: Option<f64>,
    pub label_font_style: Option<String>,
    pub label_font_weight: Option<FontWeight>,
    pub label_limit: Option<f64>,
    pub label_opacity: Option<f64>,
    pub label_overlap: Option<LabelOverlap>,
    pub label_padding: Option<f64>,
    pub labels: Option<bool>,
    pub label_separation: Option<f64>,
    pub max_extent: Option<f64>,
    pub min_extent: Option<f64>,
    pub offset: Option<f64>,
    pub orient: Option<Orient>,
    pub position: Option<f64>,
    pub tick_color: Option<String>,
    pub tick_count: Option<f64>,
    pub tick_dash: Option<Vec<f64>>,
    pub tick_dash_offset: Option<f64>,
    pub tick_extra: Option<bool>,
    pub tick_min_step: Option<f64>,
    pub tick_offset: Option<f64>,
    pub tick_opacity: Option<f64>,
    pub tick_round: Option<bool>,
    pub ticks: Option<bool>,
    pub tick_size: Option<f64>,
    pub tick_width: Option<f64>,
    pub title: Option<String>,
    pub title_align: Option<Align>,
    pub title_anchor: Option<TitleAnchor>,
    pub title_angle: Option<f64>,
    pub title_baseline: Option<TextBaseline>,
    pub title_color: Option<String>,
    pub title_font: Option<String>,
    pub title_font_size: Option<f64>,
    pub title_font_style: Option<String>,
    pub title_font_weight: Option<FontWeight>,
    pub title_limit: Option<f64>,
    pub title_opacity: Option<f64>,
    pub title_padding: Option<f64>,
    pub title_x: Option<f64>,
    pub title_y: Option<f64>,
    pub values: Option<Vec<SelectionInitArrayElement>>,
    pub zindex: Option<f64>,
}

Fields

band_position: Option<f64>

An interpolation fraction indicating where, for band scales, axis ticks should be positioned. A value of 0 places ticks at the left edge of their bands. A value of 0.5 places ticks in the middle of their bands.

Default value: 0.5

domain: Option<bool>

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

Default value: true

domain_color: Option<String>

Color of axis domain line.

Default value: "gray".

domain_dash: Option<Vec<f64>>

An array of alternating [stroke, space] lengths for dashed domain lines.

domain_dash_offset: Option<f64>

The pixel offset at which to start drawing with the domain dash array.

domain_opacity: Option<f64>

Opacity of the axis domain line.

domain_width: Option<f64>

Stroke width of axis domain line

Default value: 1

format: Option<String>

The text formatting pattern for labels of guides (axes, legends, headers) and text marks.

See the format documentation for more examples.

Default value: Derived from numberFormat config for number format and from timeFormat config for time format.

format_type: Option<FormatType>

The format type for labels ("number" or "time").

Default value:

  • "time" for temporal fields and ordinal and nomimal fields with timeUnit.
  • "number" for quantitative fields as well as ordinal and nomimal 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_color: Option<String>

Color of gridlines.

Default value: "lightGray".

grid_dash: Option<Vec<f64>>

An array of alternating [stroke, space] lengths for dashed grid lines.

grid_dash_offset: Option<f64>

The pixel offset at which to start drawing with the grid dash array.

grid_opacity: Option<f64>

The stroke opacity of grid (value between [0,1])

Default value: 1

grid_width: Option<f64>

The grid width, in pixels.

Default value: 1

label_align: Option<Align>

Horizontal text alignment of axis tick labels, overriding the default setting for the current axis orientation.

label_angle: Option<f64>

The rotation angle of the axis labels.

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

label_baseline: Option<TextBaseline>

Vertical text baseline of axis tick labels, overriding the default setting for the current axis orientation. Can be "top", "middle", "bottom", or "alphabetic".

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_color: Option<String>

The color of the tick label, can be in hex color code or regular color name.

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_flush_offset: Option<f64>

Indicates the number of pixels by which to offset flush-adjusted labels. For example, a value of 2 will push flush-adjusted labels 2 pixels outward from the center of the axis. Offsets can help the labels better visually group with corresponding axis ticks.

Default value: 0.

label_font: Option<String>

The font of the tick label.

label_font_size: Option<f64>

The font size of the label, in pixels.

label_font_style: Option<String>

Font style of the title.

label_font_weight: Option<FontWeight>

Font weight of axis tick labels.

label_limit: Option<f64>

Maximum allowed pixel width of axis tick labels.

Default value: 180

label_opacity: Option<f64>

The opacity of the labels.

label_overlap: Option<LabelOverlap>

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.

Default value: 2

labels: Option<bool>

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

Default value: true.

label_separation: Option<f64>

The minimum separation that must be between label bounding boxes for them to be considered non-overlapping (default 0). This property is ignored if labelOverlap resolution is not enabled.

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<Orient>

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

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

tick_color: Option<String>

The color of the axis's tick.

Default value: "gray"

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.

tick_dash: Option<Vec<f64>>

An array of alternating [stroke, space] lengths for dashed tick mark lines.

tick_dash_offset: Option<f64>

The pixel offset at which to start drawing with the tick mark dash array.

tick_extra: Option<bool>

Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for band scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with "bandPosition": 1 and an axis "padding" value of 0.

tick_min_step: Option<f64>

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.

Default value: undefined

tick_offset: Option<f64>

Position offset in pixels to apply to ticks, labels, and gridlines.

tick_opacity: Option<f64>

Opacity of the ticks.

tick_round: Option<bool>

Boolean flag indicating if pixel position values should be rounded to the nearest integer.

Default value: true

ticks: Option<bool>

Boolean value that determines whether the axis should include ticks.

Default value: true

tick_size: Option<f64>

The size in pixels of axis ticks.

Default value: 5

tick_width: Option<f64>

The width, in pixels, of ticks.

Default value: 1

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_align: Option<Align>

Horizontal text alignment of axis titles.

title_anchor: Option<TitleAnchor>

Text anchor position for placing axis titles.

title_angle: Option<f64>

Angle in degrees of axis titles.

title_baseline: Option<TextBaseline>

Vertical text baseline for axis titles.

title_color: Option<String>

Color of the title, can be in hex color code or regular color name.

title_font: Option<String>

Font of the title. (e.g., "Helvetica Neue").

title_font_size: Option<f64>

Font size of the title.

title_font_style: Option<String>

Font style of the title.

title_font_weight: Option<FontWeight>

Font weight of the title. This can be either a string (e.g "bold", "normal") or a number (100, 200, 300, ..., 900 where "normal" = 400 and "bold" = 700).

title_limit: Option<f64>

Maximum allowed pixel width of axis titles.

title_opacity: Option<f64>

Opacity of the axis title.

title_padding: Option<f64>

The padding, in pixels, between title and axis.

title_x: Option<f64>

X-coordinate of the axis title relative to the axis group.

title_y: Option<f64>

Y-coordinate of the axis title relative to the axis group.

values: Option<Vec<SelectionInitArrayElement>>

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

impl Clone for Axis[src]

impl Debug for Axis[src]

impl Serialize for Axis[src]

impl<'de> Deserialize<'de> for Axis[src]

Auto Trait Implementations

impl Send for Axis

impl Sync for Axis

impl Unpin for Axis

impl UnwindSafe for Axis

impl RefUnwindSafe for Axis

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]