pub struct ChartLayout {
pub total_area: Rectangle,
pub chart_area: Rectangle,
pub title_area: Option<Rectangle>,
pub legend_area: Option<Rectangle>,
pub x_axis_area: Option<Rectangle>,
pub y_axis_area: Option<Rectangle>,
}Expand description
Layout manager for chart components
Fields§
§total_area: RectangleTotal available area
chart_area: RectangleChart drawing area (after margins)
title_area: Option<Rectangle>Title area
legend_area: Option<Rectangle>Legend area
x_axis_area: Option<Rectangle>X-axis area
y_axis_area: Option<Rectangle>Y-axis area
Implementations§
Source§impl ChartLayout
impl ChartLayout
Sourcepub fn with_margins(self, margins: Margins) -> Self
pub fn with_margins(self, margins: Margins) -> Self
Apply margins to the layout
Sourcepub fn with_title(self, height: u32) -> LayoutResult<Self>
pub fn with_title(self, height: u32) -> LayoutResult<Self>
Reserve space for a title at the top
Sourcepub fn with_legend(
self,
position: LegendPosition,
size: Size,
) -> LayoutResult<Self>
pub fn with_legend( self, position: LegendPosition, size: Size, ) -> LayoutResult<Self>
Reserve space for a legend
Sourcepub fn with_x_axis(self, height: u32) -> LayoutResult<Self>
pub fn with_x_axis(self, height: u32) -> LayoutResult<Self>
Reserve space for X-axis
Sourcepub fn with_y_axis(self, width: u32) -> LayoutResult<Self>
pub fn with_y_axis(self, width: u32) -> LayoutResult<Self>
Reserve space for Y-axis
Sourcepub fn chart_area(&self) -> Rectangle
pub fn chart_area(&self) -> Rectangle
Get the final chart drawing area
Sourcepub fn validate(&self) -> LayoutResult<()>
pub fn validate(&self) -> LayoutResult<()>
Validate that the layout has sufficient space
Trait Implementations§
Source§impl Clone for ChartLayout
impl Clone for ChartLayout
Source§fn clone(&self) -> ChartLayout
fn clone(&self) -> ChartLayout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChartLayout
impl RefUnwindSafe for ChartLayout
impl Send for ChartLayout
impl Sync for ChartLayout
impl Unpin for ChartLayout
impl UnwindSafe for ChartLayout
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.