Skip to main content

HorizontalScale

Trait HorizontalScale 

Source
pub trait HorizontalScale: Send + Sync {
    // Required methods
    fn tick_marks(
        &self,
        points: &[(DateTime<Utc>, usize)],
        layout: &TickMarkLayout,
    ) -> Vec<TickMark>;
    fn format_crosshair(&self, key: DateTime<Utc>, bar_seconds: i64) -> String;
}
Expand description

What the keys of the horizontal axis mean: which of them are labelled, how, and how the crosshair label reads.

A key is the time of a bar. The time-based chart uses its TimeFormatter; Chart::set_horizontal_scale (requires widget) replaces it.

Required Methods§

Source

fn tick_marks( &self, points: &[(DateTime<Utc>, usize)], layout: &TickMarkLayout, ) -> Vec<TickMark>

The marks to label among points, the key and logical index of each bar in view in order, extended into whitespace on both sides using the chart’s full-history time mapping. When the keys reach before the first bar, every index is shifted by the same number of slots, so only the order of the indices and their differences carry meaning. The renderer places each mark at its key and skips labels that would overlap.

Source

fn format_crosshair(&self, key: DateTime<Utc>, bar_seconds: i64) -> String

The crosshair label of key. bar_seconds is the duration of the bars in view, which the time scale uses for the precision of the clock.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl HorizontalScale for Box<dyn TimeFormatter>

The time scale: calendar and clock boundaries in the formatter’s zone.

Source§

fn tick_marks( &self, points: &[(DateTime<Utc>, usize)], layout: &TickMarkLayout, ) -> Vec<TickMark>

Source§

fn format_crosshair(&self, key: DateTime<Utc>, bar_seconds: i64) -> String

Implementors§