pub struct CompareSymbolsDialog {
pub is_open: bool,
pub compared_symbols: Vec<CompareSymbol>,
/* private fields */
}Expand description
Compare symbols dialog
Allows comparing multiple symbols on the same chart with:
- Search for symbols to add
- Suggestions from the symbols the host passes in, with an empty state when there are none
- Color-coded symbols
- Visibility toggles
§Example
use egui_charts::model::Instrument;
use egui_charts::ui::top_toolbar::{CompareAction, CompareSymbolsDialog};
let mut compare = CompareSymbolsDialog::new();
compare.open();
let symbols = vec![Instrument::new("ETHUSDT").with_description("Ethereum / Tether")];
match compare.show(ctx, &symbols) {
CompareAction::AddSymbol(sym, placement) => {
// Add the symbol to the chart where `placement` says
}
CompareAction::RemoveSymbol(sym) => {
// Remove symbol from chart
}
_ => {}
}Fields§
§is_open: boolIs dialog open
compared_symbols: Vec<CompareSymbol>Current comparison series on the host’s chart. Update after accepting an intent, including changes made outside this dialog.
Implementations§
Source§impl CompareSymbolsDialog
impl CompareSymbolsDialog
Sourcepub fn set_search_service(&mut self, service: Option<Arc<dyn SymbolSearch>>)
pub fn set_search_service(&mut self, service: Option<Arc<dyn SymbolSearch>>)
Connects the same host service used by symbol search.
Sourcepub fn set_storage(&mut self, storage: Arc<dyn Storage>)
pub fn set_storage(&mut self, storage: Arc<dyn Storage>)
Lists the instruments symbol search recently opened, from the same host storage, while the query is empty.
Sourcepub fn with_config(self, config: CompareSymbolsConfig) -> Self
pub fn with_config(self, config: CompareSymbolsConfig) -> Self
Create with custom configuration
Sourcepub fn show(&mut self, ctx: &Context, symbols: &[Instrument]) -> CompareAction
pub fn show(&mut self, ctx: &Context, symbols: &[Instrument]) -> CompareAction
Show the dialog, suggesting symbols: the symbols the host’s data source offers
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CompareSymbolsDialog
impl !UnwindSafe for CompareSymbolsDialog
impl Freeze for CompareSymbolsDialog
impl Send for CompareSymbolsDialog
impl Sync for CompareSymbolsDialog
impl Unpin for CompareSymbolsDialog
impl UnsafeUnpin for CompareSymbolsDialog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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