Struct XyTimeData

Source
pub struct XyTimeData { /* private fields */ }
Expand description

Animatable 2d line chart.

§Usage

Ensure the timechart feature is enabled to use this type.

Creating the chart is very simple. You only need to provide 4 parameters, 3 of which are just strings.

  • points: A slice of tuples, arranged so that the first float is the x position, the second the y position, and the third is the time the next point is to be shown at(or in the case of the last point, the time the animation ends).
  • x_unit: String describing the data on the X axis.
  • y_unit: String describing the data on the Y axis.
  • caption: String to be shown as the caption of the chart.

This will create a basic line chart with nothing fancy, which you can easily add to your egui project. You can also animate this chart with .toggle_playback() and adjust various parameters with the many .set_ functions included.

Implementations§

Source§

impl XyTimeData

Source

pub fn new( points: &[(f32, f32, f32)], x_unit: &str, y_unit: &str, caption: &str, ) -> Self

Create a new XyTimeData chart. See Usage.

Source

pub fn set_time(&mut self, time: f32)

Set the time to resume playback at. Time is in seconds.

Source

pub fn time(self, time: f32) -> Self

Set the time to resume playback at. Time is in seconds. Consumes self.

Source

pub fn set_playback_speed(&mut self, speed: f32)

Set the playback speed. 1.0 is normal speed, 2.0 is double, & 0.5 is half.

Source

pub fn playback_speed(self, speed: f32) -> Self

Set the playback speed. 1.0 is normal speed, 2.0 is double, & 0.5 is half. Consumes self.

Source

pub fn set_line_style(&mut self, line_style: ShapeStyle)

Set the style of the plotted line.

Source

pub fn line_style(self, line_style: ShapeStyle) -> Self

Set the style of the plotted line. Consumes self.

Source

pub fn set_grid_style(&mut self, grid_style: ShapeStyle)

Set the style of the grid.

Source

pub fn grid_style(self, grid_style: ShapeStyle) -> Self

Set the style of the grid. Consumes self.

Source

pub fn set_subgrid_style(&mut self, subgrid_style: ShapeStyle)

Set the style of the subgrid.

Source

pub fn subgrid_style(self, subgrid_style: ShapeStyle) -> Self

Set the style of the subgrid. Consumes self.

Source

pub fn set_axes_style(&mut self, axes_style: ShapeStyle)

Set the style of the axes.

Source

pub fn axes_style(self, axes_style: ShapeStyle) -> Self

Set the style of the plotted line. Consumes self.

Source

pub fn set_text_color<T>(&mut self, color: T)
where T: Into<RGBAColor>,

Set the text color of the chart.

Source

pub fn text_color<T>(self, color: T) -> Self
where T: Into<RGBAColor>,

Set the text color of the chart. Consumes self.

Source

pub fn set_background_color<T>(&mut self, color: T)
where T: Into<RGBAColor>,

Set the background color of the chart.

Source

pub fn background_color<T>(self, color: T) -> Self
where T: Into<RGBAColor>,

Set the background color of the chart. Consumes self.

Source

pub fn set_ratio(&mut self, ratio: f32)

Set the ratio between X and Y values, default being 1 x unit to 1 y unit.

Source

pub fn ratio(self, ratio: f32) -> Self

Set the ratio between X and Y values, default being 1 x unit to 1 y unit. Consumes self.

Source

pub fn draw(&mut self, ui: &Ui)

Draw the chart to a Ui. Will also proceed to animate the chart if playback is currently enabled.

Source

pub fn start_playback(&mut self)

Start/enable playback of the chart.

Source

pub fn stop_playback(&mut self)

Stop/disable playback of the chart.

Source

pub fn toggle_playback(&mut self)

Toggle playback of the chart.

Source

pub fn is_playing(&self) -> bool

Return true if playback is currently enabled & underway.

Source

pub fn start_time(&self) -> f32

Return the time the chart starts at when playback is enabled.

Source

pub fn current_time(&mut self) -> f32

Return the current time to be animated when playback is enabled.

Source

pub fn end_time(&self) -> f32

Return the time the chart finished animating at when playback is enabled.

Source

pub fn get_playback_speed(&self) -> f32

Return the speed the chart is animated at.

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
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, 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.