pub struct LineChart { /* private fields */ }Expand description
Multi-series line / step / area / scatter chart with sub-cell resolution.
§Example
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget};
use tui_chart::{LineChart, Series};
let chart = LineChart::new(vec![Series::new("squares").data((0..10).map(|i| (i as f64, (i * i) as f64)))]);
let area = Rect::new(0, 0, 40, 12);
let mut buf = Buffer::empty(area);
chart.render(area, &mut buf);Implementations§
Source§impl LineChart
impl LineChart
Sourcepub fn y2_axis(self, axis: Axis) -> Self
pub fn y2_axis(self, axis: Axis) -> Self
Secondary (right) y axis configuration, used by secondary_axis(true) series.
Sourcepub fn y_log(self, v: bool) -> Self
pub fn y_log(self, v: bool) -> Self
Logarithmic (base 10) primary y axis with decade ticks. Non-positive values are not drawn.
Sourcepub fn annotation(self, annotation: Annotation) -> Self
pub fn annotation(self, annotation: Annotation) -> Self
Add an annotation (reference line, region or label).
Sourcepub fn theme(self, theme: impl Into<Theme>) -> Self
pub fn theme(self, theme: impl Into<Theme>) -> Self
Apply a Theme: axis/grid/border colors, background fill and the series
palette. Explicit series colors and explicitly styled axes still win.
Sourcepub fn base_style(self, style: Style) -> Self
pub fn base_style(self, style: Style) -> Self
Base style painted over the whole area (beats the theme).
Sourcepub fn legend_style(self, v: Style) -> Self
pub fn legend_style(self, v: Style) -> Self
Style of legend entry text (default: theme muted color / gray).
Sourcepub fn legend(self, v: LegendPosition) -> Self
pub fn legend(self, v: LegendPosition) -> Self
Legend placement.
Hide the series with these indices (axes rescale to the rest). Hidden
series stay in the legend, dimmed, so they can be toggled back; see
Interaction.
Sourcepub fn bounds(&self) -> ((f64, f64), (f64, f64))
pub fn bounds(&self) -> ((f64, f64), (f64, f64))
Resolved (x_bounds, y_bounds) (primary axis, data coordinates).
Trait Implementations§
Source§impl Themed for LineChart
Available on crate feature theme only.
impl Themed for LineChart
theme only.Source§fn apply_theme(self, theme: &Theme) -> Self
fn apply_theme(self, theme: &Theme) -> Self
self styled from theme. Explicit per-item colors set on the
widget should keep winning over the theme.Source§fn themed(self, provider: &impl ThemeProvider) -> Self
fn themed(self, provider: &impl ThemeProvider) -> Self
ThemeProvider.Auto Trait Implementations§
impl !RefUnwindSafe for LineChart
impl !UnwindSafe for LineChart
impl Forget for LineChart
impl Freeze for LineChart
impl Send for LineChart
impl Sync for LineChart
impl Unpin for LineChart
impl UnsafeUnpin for LineChart
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more