Graph

Struct Graph 

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

The main interface for the Graph widget.

Implementations§

Source§

impl Graph

Source

pub const DEFAULT_ZOOM_RANGE: Rangef

The default zoom range.

Allows zooming out 4x, but does not allow zooming in past the pixel-perfect default level.

Source

pub const DEFAULT_CENTER_VIEW: bool = false

Source

pub fn new(id_src: impl Hash) -> Self

Begin building the new graph widget.

Source

pub fn from_id(id: Id) -> Self

The same as Graph::new, but allows providing an egui::Id directly.

Source

pub fn background(self, show: bool) -> Self

Whether or not to fill the background. Default is true.

Source

pub fn dot_grid(self, show: bool) -> Self

Whether or not to show the dot grid. Default is true.

Source

pub fn zoom_range(self, zoom_range: impl Into<Rangef>) -> Self

Set the allowed zoom range.

A zoom < 1.0 zooms out, while a zoom > 1.0 zooms in.

Default: Graph::DEFAULT_ZOOM_RANGE.

Source

pub fn max_inner_size(self, max_inner_size: impl Into<Vec2>) -> Self

Set the maximum size of the scene’s inner [Ui] that will be created.

Source

pub fn center_view(self, center_view: bool) -> Self

Whether or not to center the view around the content of the graph.

Default: Self::DEFAULT_CENTER_VIEW.

Source

pub fn show<R>( self, view: &mut View, ui: &mut Ui, content: impl FnOnce(&mut Ui, Show<'_>) -> R, ) -> InnerResponse<R>

Begin showing the Graph.

Returns the InnerResponse of the inner Scene.

Auto Trait Implementations§

§

impl Freeze for Graph

§

impl RefUnwindSafe for Graph

§

impl Send for Graph

§

impl Sync for Graph

§

impl Unpin for Graph

§

impl UnwindSafe for Graph

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.