pub struct Chart { /* private fields */ }Expand description
Main chart instance that manages rendering and data
Implementations§
Source§impl Chart
impl Chart
Sourcepub async fn new(config: ChartConfig) -> Result<Self>
pub async fn new(config: ChartConfig) -> Result<Self>
Create a new chart with the given configuration
Sourcepub async fn new_financial(config: ChartConfig) -> Result<Self>
pub async fn new_financial(config: ChartConfig) -> Result<Self>
Create a basic financial chart with default layers
Sourcepub fn get_layer_mut(&mut self, name: &str) -> Option<&mut (dyn Layer + '_)>
pub fn get_layer_mut(&mut self, name: &str) -> Option<&mut (dyn Layer + '_)>
Get a mutable reference to a layer
Sourcepub fn set_layer_enabled(&mut self, name: &str, enabled: bool) -> bool
pub fn set_layer_enabled(&mut self, name: &str, enabled: bool) -> bool
Enable or disable a layer
Sourcepub fn set_viewport_bounds(&mut self, bounds: ChartBounds)
pub fn set_viewport_bounds(&mut self, bounds: ChartBounds)
Set viewport bounds
Sourcepub fn zoom(&mut self, center_x: f32, center_y: f32, zoom_factor: f32)
pub fn zoom(&mut self, center_x: f32, center_y: f32, zoom_factor: f32)
Zoom the viewport around a center point
Sourcepub fn fit_to_data(&mut self) -> Result<()>
pub fn fit_to_data(&mut self) -> Result<()>
Reset viewport to fit all data
Sourcepub fn set_config(&mut self, config: ChartConfig)
pub fn set_config(&mut self, config: ChartConfig)
Update chart configuration
Sourcepub fn config(&self) -> &ChartConfig
pub fn config(&self) -> &ChartConfig
Get current configuration
Sourcepub fn set_theme(&mut self, theme: ChartTheme)
pub fn set_theme(&mut self, theme: ChartTheme)
Set chart theme
Sourcepub fn needs_render(&self) -> bool
pub fn needs_render(&self) -> bool
Check if chart needs to be re-rendered
Sourcepub fn dimensions(&self) -> (u32, u32)
pub fn dimensions(&self) -> (u32, u32)
Get chart dimensions
Sourcepub fn screen_to_chart(&self, screen_x: f32, screen_y: f32) -> Vec2
pub fn screen_to_chart(&self, screen_x: f32, screen_y: f32) -> Vec2
Convert screen coordinates to chart coordinates
Sourcepub fn chart_to_screen(&self, chart_x: f32, chart_y: f32) -> Vec2
pub fn chart_to_screen(&self, chart_x: f32, chart_y: f32) -> Vec2
Convert chart coordinates to screen coordinates
Sourcepub fn hit_test(
&self,
screen_x: f32,
screen_y: f32,
) -> Option<(usize, DateTime<Utc>, f64, f64, f64, f64, f64)>
pub fn hit_test( &self, screen_x: f32, screen_y: f32, ) -> Option<(usize, DateTime<Utc>, f64, f64, f64, f64, f64)>
Find data point at screen coordinates Returns: (index, timestamp, start, max, min, end, auxiliary)
Sourcepub fn visible_time_range(&self) -> (i64, i64)
pub fn visible_time_range(&self) -> (i64, i64)
Get visible time range as timestamps
Sourcepub fn visible_price_range(&self) -> (f64, f64)
pub fn visible_price_range(&self) -> (f64, f64)
Get visible price range
Auto Trait Implementations§
impl !Freeze for Chart
impl !RefUnwindSafe for Chart
impl Send for Chart
impl !Sync for Chart
impl Unpin for Chart
impl UnsafeUnpin for Chart
impl !UnwindSafe for Chart
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