Skip to main content

ChartEvent

Enum ChartEvent 

Source
#[non_exhaustive]
pub enum ChartEvent {
Show 17 variants EventsDropped(usize), VisibleRangeChanged(Option<VisibleTimeRange>), VisibleLogicalRangeChanged(Option<LogicalRange>), TimeScaleResized(Vec2), CrosshairMoved(Option<ChartPointer>), Click { position: ChartPointer, button: PointerButton, }, DoubleClick { position: ChartPointer, }, MarkClick { id: String, series: SeriesId, time: DateTime<Utc>, }, LinkClick { drawing: usize, link: String, }, ImageRequested(ImageRequest), DataLoaded { series: SeriesId, bars: usize, }, DataUpdated { series: SeriesId, bars: usize, }, DataOperation { series: SeriesId, operation: DataOperation, bars: usize, }, SymbolChanged(String), TimeframeChanged(Timeframe), SeriesAdded(SeriesId), SeriesRemoved(SeriesId),
}
Expand description

A notification for the host. Existing selection and action polling APIs remain independent.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

EventsDropped(usize)

Oldest notifications dropped because the host did not drain the 1024-entry queue. Emitted first on the next drain; read the current chart state to recover.

§

VisibleRangeChanged(Option<VisibleTimeRange>)

The UTC plot edges changed; None means there is no data to map.

§

VisibleLogicalRangeChanged(Option<LogicalRange>)

The visible logical range changed, as Chart::visible_logical_range returns it, including changes of bar spacing alone; None means there is no data.

§

TimeScaleResized(Vec2)

The time axis changed size, as Chart::time_scale_size returns it, including its first non-zero size.

§

CrosshairMoved(Option<ChartPointer>)

The local cursor moved or anything its pointer carries changed, such as the bar under a stationary cursor or a held modifier; None means it left the plots or no eligible crosshair index remains in view. Programmatically synchronized cursors do not emit this event.

§

Click

A primary or secondary click in a plot, including clicks selecting drawings or studies.

Fields

§position: ChartPointer

Click location in the pane’s units.

§button: PointerButton

The button released to complete the click.

§

DoubleClick

A primary double click in a plot, after the Self::Click of each of its clicks.

Fields

§position: ChartPointer

Location of the second click.

§

MarkClick

A primary click on a bar mark with a host ID. Of overlapping marks the one painted on top is reported, and the click selects nothing else.

Fields

§id: String

The Marker::id the host gave the mark.

§series: SeriesId

The series the mark belongs to; SeriesId::MAIN for the main series.

§time: DateTime<Utc>

The time of the mark; on price-based chart types, of the element it sits on.

§

LinkClick

A primary click on the Open row of a post or idea card with a link. Open the post or idea it names; the link may be any text the user typed, so check it, such as its scheme, before opening it. The click also selects the card, as any click on it does.

Fields

§drawing: usize

Id of the drawing.

§

ImageRequested(ImageRequest)

The user placed an image or dropped picture files on the price pane. Answer with Chart::set_drawing_image; until then the image shows its placeholder.

§

DataLoaded

A successful history page or set_data completed, including an empty result. Live updates emit DataUpdated instead; failed or obsolete feed replies emit nothing.

Fields

§series: SeriesId

Bar series that received data.

§bars: usize

Total accepted bars now held by that series, after cleaning and merging.

§

DataUpdated

A live bar from update or the chart’s feed changed the bars of a series, or pop_bars removed some. Changes of one series in a row are reported once, with the latest count.

Fields

§series: SeriesId

Bar series whose bars changed.

§bars: usize

Total bars now held by that series.

§

DataOperation

One accepted set_data or update call, when enabled with Chart::set_data_operation_notifications. Never coalesced; additional to the compact DataLoaded and DataUpdated events. Feed replies, removals and constructor data do not emit this event. Overflow is reported by EventsDropped as for other notifications.

Fields

§series: SeriesId

Bar series that accepted the operation.

§operation: DataOperation

The operation and, for an update, its incoming bar time.

§bars: usize

Total bars now held in the series’ current window, after cleaning and retention.

§

SymbolChanged(String)

The symbol setter accepted a different symbol.

§

TimeframeChanged(Timeframe)

The interval setter accepted a different interval.

§

SeriesAdded(SeriesId)

An added bar series joined the chart: through Chart::add_series or Chart::add_comparison, a restored snapshot, or undo or redo bringing back a series. Undo and redo keep its id, options, visibility, pane, scale, markers, price lines, price formatter, bar limit and bars, under the current replay cutoff. Supply current bars with Chart::set_data and resume Chart::update. Snapshot restore assigns new ids and leaves supplying bars to the host.

§

SeriesRemoved(SeriesId)

An added bar series left the chart: through Chart::remove_series or Chart::remove_pane, the pane menu, a restored snapshot, or undo or redo of the edit that added it. Data sent for it is ignored from then on. Undo or redo can bring it back with the same id, so keep what the host needs to feed it again.

Trait Implementations§

Source§

impl Clone for ChartEvent

Source§

fn clone(&self) -> ChartEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChartEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ChartEvent

Source§

fn eq(&self, other: &ChartEvent) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ChartEvent

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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
Source§

impl<T> MaybeSend for T
where T: Send + Sync + ?Sized,

§

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

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.