pub trait ChartModel {
// Required methods
fn x_extent(&self) -> Option<(f64, f64)>;
fn y_axis(&self, pane: usize, x: &Axis) -> Option<Axis>;
fn paint(
&self,
pane: usize,
plot: &Plot,
canvas: &mut Canvas<'_>,
palette: &ChartPalette,
);
// Provided methods
fn x_kind(&self) -> AxisKind { ... }
fn x_step(&self) -> Option<f64> { ... }
fn panes(&self) -> usize { ... }
fn pane_weight(&self, pane: usize) -> f32 { ... }
fn pane_title(&self, _pane: usize) -> &str { ... }
fn category(&self, index: usize) -> Option<&str> { ... }
fn prepare(&mut self) { ... }
fn describe(&self) -> String { ... }
}Expand description
The data of a chart widget (densa_widgets::Chart): panes stacked top to bottom on one
horizontal axis, each drawing its own series (candles over a line, volume bars below).
The widget decides what part of x shows (it follows the newest data until the user
pans or zooms) and asks each pane for its vertical axis over that part, so panes scale to
what is on screen. Painting goes through the series functions of this crate, which
allocate nothing.
Required Methods§
Sourcefn x_extent(&self) -> Option<(f64, f64)>
fn x_extent(&self) -> Option<(f64, f64)>
The lowest and highest x of the data, or None while there is none. On a
Category axis, the edges of the places: (-0.5, n - 0.5) for
n bars, so a view of all of them shows every bar whole.
Provided Methods§
Sourcefn x_step(&self) -> Option<f64>
fn x_step(&self) -> Option<f64>
The distance between two points (a candle’s period, 1.0 between bars), if the data
has one: the widget zooms in no further than a few of them, or than all of them when
there are fewer.
Sourcefn pane_weight(&self, pane: usize) -> f32
fn pane_weight(&self, pane: usize) -> f32
Pane pane‘s share of the height, against the others’ (above zero).
Sourcefn pane_title(&self, _pane: usize) -> &str
fn pane_title(&self, _pane: usize) -> &str
The name of pane pane (“Volume”), written on a line of its own above the pane, cut
off where the pane ends. A pane without a name (empty, the default) has no such line.
Sourcefn category(&self, index: usize) -> Option<&str>
fn category(&self, index: usize) -> Option<&str>
The name of place index of a Category x axis, written
under it and in the crosshair’s box; None (the default) for none there.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".