Struct egui_plotter::Chart

source ·
pub struct Chart { /* 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 Chart

source

pub fn new() -> Self

Create a new 3d chart with default settings.

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, &Option<Box<dyn Any>>)> )

Set the builder callback.

source

pub fn builder_cb( self, builder_cb: Box<dyn FnMut(&mut DrawingArea<EguiBackend<'_>, Shift>, &Transform, &Option<Box<dyn Any>>)> ) -> 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 set_data(&mut self, data: Box<dyn Any>)

Set the data of the chart.

source

pub fn data(self, data: Box<dyn Any>) -> Self

Set the data of the chart. Consumes self.

source

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

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Chart

§

impl !Send for Chart

§

impl !Sync for Chart

§

impl Unpin for Chart

§

impl !UnwindSafe for Chart

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.