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
impl Graph
Sourcepub fn build_ui<C>(config: Config, container: &C, gdk_window: &Window) -> Graph
pub fn build_ui<C>(config: Config, container: &C, gdk_window: &Window) -> Graph
Build and show a Graph
widget in the target gtk::Container
.
Sourcepub fn base_zoom_x(&self) -> f64
pub fn base_zoom_x(&self) -> f64
Return the initial and maximally zoomed out zoom level, in units of time per x pixel.
Sourcepub fn max_zoom_x(&self) -> f64
pub fn max_zoom_x(&self) -> f64
Return the maximally zoomed in zoom level, in units of time per x pixel.
Sourcepub fn first_t(&self) -> Time
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.
Sourcepub fn set_zoom_x(&self, new_zoom_x: f64)
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
.
Sourcepub fn set_follow(&self)
pub fn set_follow(&self)
Sets the graph to follow the latest data.
Sourcepub fn view_observable(&mut self) -> RefMut<'_, ReadHalf<View>>
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.
Sourcepub fn drawing_area(&self) -> DrawingArea
pub fn drawing_area(&self) -> DrawingArea
Returns the DrawingArea
gtk widget the graph is drawn on, so
you can connect to its signals.
Sourcepub fn drawing_area_pos_to_point(&self, x: f64, _y: f64) -> Option<Point>
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.