Struct Chart

Source
pub struct Chart<Data> { /* private fields */ }
Expand description

Allows users to drag, rotate, and zoom in/out on your plots.

§Usage

Charts are designed to be easy to implement and use, while simultaniously being powerful enough for your application. You can manipulate the following properties of a chart to get the effects you want:

  • builder_cb - Callback used to populate the chart. Is provided a DrawingArea and the chart’s data.
  • mouse - Mouse configuration. Configure how you wish the mouse to affect/manipulate the chart.
  • data - A Box of data of any type to be stored with the chart. Provided so that you can modify data without having to specify a new callback during runtime. For example, examples/parachart.rs uses it to store the range so it can be changed during runtime.

§Examples

See examples/3dchart.rs and examples/parachart.rs for examples of usage.

Implementations§

Source§

impl<Data> Chart<Data>

Source

pub fn new(data: Data) -> Self

Create a new chart with default settings (if not using data supply ())

Source

pub fn set_mouse(&mut self, mouse: MouseConfig)

Enable or disable mouse controls.

Source

pub fn mouse(self, mouse: MouseConfig) -> Self

Enable or disable mouse controls. Consumes self.

Source

pub fn set_builder_cb( &mut self, builder_cb: Box<dyn FnMut(&mut DrawingArea<EguiBackend<'_>, Shift>, &Transform, &Data)>, )

Set the builder callback.

Source

pub fn builder_cb( self, builder_cb: Box<dyn FnMut(&mut DrawingArea<EguiBackend<'_>, Shift>, &Transform, &Data)>, ) -> Self

Set the builder callback. Consumes self.

Source

pub fn set_pitch(&mut self, pitch: f64)

Set the pitch of the chart.

Source

pub fn pitch(self, pitch: f64) -> Self

Set the pitch of the chart. Consumes self.

Source

pub fn set_yaw(&mut self, yaw: f64)

Set the yaw of the chart.

Source

pub fn yaw(self, yaw: f64) -> Self

Set the yaw of the chart. Consumes self.

Source

pub fn set_scale(&mut self, scale: f64)

Set the scale of the chart.

Source

pub fn scale(self, scale: f64) -> Self

Set the scale of the chart. Consumes self.

Source

pub fn get_data(&self) -> &Data

Get the data of the chart as a reference.

Source

pub fn get_data_mut(&mut self) -> &mut Data

Get the data of the chart as a mutable reference.

Source

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

Call the callback and draw the chart to a UI element.

Auto Trait Implementations§

§

impl<Data> Freeze for Chart<Data>
where Data: Freeze,

§

impl<Data> !RefUnwindSafe for Chart<Data>

§

impl<Data> !Send for Chart<Data>

§

impl<Data> !Sync for Chart<Data>

§

impl<Data> Unpin for Chart<Data>
where Data: Unpin,

§

impl<Data> !UnwindSafe for Chart<Data>

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.