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’sdata
.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>
impl<Data> Chart<Data>
Sourcepub fn new(data: Data) -> Self
pub fn new(data: Data) -> Self
Create a new chart with default settings (if not using data supply ())
Sourcepub fn set_mouse(&mut self, mouse: MouseConfig)
pub fn set_mouse(&mut self, mouse: MouseConfig)
Enable or disable mouse controls.
Sourcepub fn mouse(self, mouse: MouseConfig) -> Self
pub fn mouse(self, mouse: MouseConfig) -> Self
Enable or disable mouse controls. Consumes self.
Sourcepub fn set_builder_cb(
&mut self,
builder_cb: Box<dyn FnMut(&mut DrawingArea<EguiBackend<'_>, Shift>, &Transform, &Data)>,
)
pub fn set_builder_cb( &mut self, builder_cb: Box<dyn FnMut(&mut DrawingArea<EguiBackend<'_>, Shift>, &Transform, &Data)>, )
Set the builder callback.
Sourcepub fn builder_cb(
self,
builder_cb: Box<dyn FnMut(&mut DrawingArea<EguiBackend<'_>, Shift>, &Transform, &Data)>,
) -> Self
pub fn builder_cb( self, builder_cb: Box<dyn FnMut(&mut DrawingArea<EguiBackend<'_>, Shift>, &Transform, &Data)>, ) -> Self
Set the builder callback. Consumes self.
Sourcepub fn get_data_mut(&mut self) -> &mut Data
pub fn get_data_mut(&mut self) -> &mut Data
Get the data of the chart as a mutable reference.
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> 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