pub struct Treemap { /* private fields */ }Expand description
Squarified treemap widget.
§Example
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget};
use tui_chart::{Treemap, TreemapItem};
let chart = Treemap::new([TreemapItem::new("a", 5.0), TreemapItem::new("b", 3.0)]);
let area = Rect::new(0, 0, 40, 12);
let mut buf = Buffer::empty(area);
chart.render(area, &mut buf);Implementations§
Source§impl Treemap
impl Treemap
Sourcepub fn chamfered(self, on: bool) -> Self
pub fn chamfered(self, on: bool) -> Self
Cyberpunk look: cut the top-left and bottom-right corner of every leaf.
Sourcepub fn new(items: impl IntoIterator<Item = TreemapItem>) -> Self
pub fn new(items: impl IntoIterator<Item = TreemapItem>) -> Self
Create from items.
Sourcepub fn gap(self, v: bool) -> Self
pub fn gap(self, v: bool) -> Self
Leave a thin gutter (one column, half a row) between leaf tiles so neighbours stay distinguishable (default on).
Sourcepub fn gradient(self, low: Color, high: Color) -> Self
pub fn gradient(self, low: Color, high: Color) -> Self
Color items without explicit color by value, interpolating low→high
(use Color::Rgb values for smooth results).
Sourcepub fn border_color(self, v: Color) -> Self
pub fn border_color(self, v: Color) -> Self
Border color.
Sourcepub fn theme(self, theme: impl Into<Theme>) -> Self
pub fn theme(self, theme: impl Into<Theme>) -> Self
Apply a Theme: items without a color are colored by value along the
theme gradient; cell borders use the theme background. Explicit item
colors, Treemap::gradient and Treemap::border_color 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 show_values(self, v: bool) -> Self
pub fn show_values(self, v: bool) -> Self
Print the value under the label when there is room.
Trait Implementations§
Source§impl Themed for Treemap
Available on crate feature theme only.
impl Themed for Treemap
Available on crate feature
theme only.Source§fn apply_theme(self, theme: &Theme) -> Self
fn apply_theme(self, theme: &Theme) -> Self
Return
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
Apply the theme produced by any
ThemeProvider.Auto Trait Implementations§
impl Forget for Treemap
impl Freeze for Treemap
impl RefUnwindSafe for Treemap
impl Send for Treemap
impl Sync for Treemap
impl Unpin for Treemap
impl UnsafeUnpin for Treemap
impl UnwindSafe for Treemap
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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