Skip to main content

Legend

Struct Legend 

Source
pub struct Legend<'a> {
Show 25 fields pub formatters: ValueFormatters<'a>, pub symbol: &'a str, pub timeframe: &'a str, pub instrument: Option<&'a Instrument>, pub bar: &'a Bar, pub previous_close: Option<f64>, pub quote: Option<&'a Level1Quote>, pub badge: Option<ImageSource<'a>>, pub show_logo: bool, pub show_market_status: bool, pub statuses: &'a [LegendStatus<'a>], pub studies: &'a [Box<dyn Indicator>], pub study_inputs: &'a [&'a str], pub bar_index: usize, pub show_volume: bool, pub show_title: bool, pub title_as_description: bool, pub show_ohlc: bool, pub show_change: bool, pub show_change_percent: bool, pub show_indicator_titles: bool, pub show_indicator_inputs: bool, pub show_indicator_values: bool, pub day_change: Option<(f64, f64)>, pub study_backdrop: f32, /* private fields */
}
Expand description

An in-pane legend. Historical readout data and current quotes are supplied independently.

Fields§

§formatters: ValueFormatters<'a>

Host number formatting for this series’ readouts.

§symbol: &'a str

Fallback title when the instrument has no description.

§timeframe: &'a str

Display interval.

§instrument: Option<&'a Instrument>

Description, exchange and price precision reported by the host.

§bar: &'a Bar

The bar selected by the crosshair, or the latest bar when none is selected.

§previous_close: Option<f64>

Close of the bar preceding bar, including when it is outside the viewport.

§quote: Option<&'a Level1Quote>

Current host quote, independent of bar. Invalid or crossed quotes are omitted.

§badge: Option<ImageSource<'a>>

Image for the symbol mark before the title, in place of the instrument’s logo.

Show the symbol mark before the title: badge, else the instrument’s logo, else the symbol’s first letter or digit on a neutral disc.

§show_market_status: bool

Show the market status after the title: the session’s state, when known, and delayed or end-of-day data.

§statuses: &'a [LegendStatus<'a>]

Optional host-owned status marks.

§studies: &'a [Box<dyn Indicator>]

Studies on the chart. Overlay studies retain a row while hidden so they can be shown again.

§study_inputs: &'a [&'a str]

Display inputs supplied by the host, in studies order. Missing entries are omitted.

§bar_index: usize

Global index of bar in each study’s values.

§show_volume: bool

Whether this series has volume.

§show_title: bool

Display the title row: the symbol mark, the instrument title and the status marks.

§title_as_description: bool

Prefer the host description over the ticker.

§show_ohlc: bool

Display OHLC fields, or the close alone in a compact plot.

§show_change: bool

Display absolute bar change.

§show_change_percent: bool

Display percentage bar change.

§show_indicator_titles: bool

Display study names.

§show_indicator_inputs: bool

Display supplied study inputs.

§show_indicator_values: bool

Display study outputs.

§day_change: Option<(f64, f64)>

The previous session’s close and the last price, shown after the bar change as the change between them.

§study_backdrop: f32

Opacity from 0 to 1 of the chart background behind the volume and study rows. Text and controls retain opaque backing so profiles cannot interfere with them.

Implementations§

Source§

impl<'a> Legend<'a>

Source

pub fn new(symbol: &'a str, timeframe: &'a str, bar: &'a Bar) -> Self

A series readout with volume and no optional host metadata or quotes.

Source

pub fn show(&self, ui: &mut Ui, plot: Rect) -> Option<QuoteSide>

Paints inside plot, inset by the theme’s large spacing from its sides and medium spacing from its top and bottom, and reports a quote intent. Supplementary volume and study rows collapse together; quotes remain visible.

Source

pub fn show_with_study_actions( &self, ui: &mut Ui, plot: Rect, ) -> (Option<QuoteSide>, Option<StudyAction>)

Paint the legend and report quote and study intents independently. Each study intent identifies its zero-based index in studies.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Legend<'a>

§

impl<'a> !Send for Legend<'a>

§

impl<'a> !Sync for Legend<'a>

§

impl<'a> !UnwindSafe for Legend<'a>

§

impl<'a> Freeze for Legend<'a>

§

impl<'a> Unpin for Legend<'a>

§

impl<'a> UnsafeUnpin for Legend<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.