Struct Graph

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

A GTK widget that draws a graph.

Graph contains no controls to navigate it, you are expected to provide your own controls using the methods and signals it provides. Or you can use GraphWithControls that comes with a set of controls.

Implementations§

Source§

impl Graph

Source

pub fn build_ui<C>(config: Config, container: &C, gdk_window: &Window) -> Graph
where C: IsA<Container> + IsA<Widget>,

Build and show a Graph widget in the target gtk::Container.

Source

pub fn show(&self)

Show the graph.

Source

pub fn hide(&self)

Hide the graph.

Source

pub fn width(&self) -> u32

Return the width of the graph

Source

pub fn height(&self) -> u32

Return the height of the graph

Source

pub fn base_zoom_x(&self) -> f64

Return the initial and maximally zoomed out zoom level, in units of time per x pixel.

Source

pub fn max_zoom_x(&self) -> f64

Return the maximally zoomed in zoom level, in units of time per x pixel.

Source

pub fn view(&self) -> View

Return a description of the current view

Source

pub fn last_t(&self) -> Time

Return the most recent time value.

Source

pub fn first_t(&self) -> Time

Return the longest ago time value that is still stored. Note that the oldest data is discarded to keep memory usage bounded.

Source

pub fn set_zoom_x(&self, new_zoom_x: f64)

Change the zoom level on the graph.

Any value you pass in will be clamped between base_zoom_x and max_zoom_x.

Source

pub fn set_follow(&self)

Sets the graph to follow the latest data.

Source

pub fn scroll(&self, new_val: f64)

Scrolls the graph to view a certain time value.

Source

pub fn view_observable(&mut self) -> RefMut<'_, ReadHalf<View>>

Return an observable that lets you track the current View, which describes what is currently showing on the graph.

Source

pub fn drawing_area(&self) -> DrawingArea

Returns the DrawingArea gtk widget the graph is drawn on, so you can connect to its signals.

Source

pub fn drawing_area_pos_to_point(&self, x: f64, _y: f64) -> Option<Point>

Maps a position on drawing_area to the data point that is currently drawn there. Useful for handling clicks on the graph.

Returns None if no appropriate point can be found, for example if the data point for a scroll position has already been discarded.

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.