pub struct DefaultLegend<C: PixelColor> {
pub entries: Vec<DefaultLegendEntry<C>, 8>,
pub position: LegendPosition,
pub orientation: LegendOrientation,
pub style: LegendStyle<C>,
}Expand description
Default legend configuration
Fields§
§entries: Vec<DefaultLegendEntry<C>, 8>Legend entries
position: LegendPositionLegend position
orientation: LegendOrientationLegend orientation
style: LegendStyle<C>Legend style
Implementations§
Source§impl<C: PixelColor + From<Rgb565>> DefaultLegend<C>
impl<C: PixelColor + From<Rgb565>> DefaultLegend<C>
Sourcepub fn new(position: LegendPosition) -> Self
pub fn new(position: LegendPosition) -> Self
Create a new default legend
Sourcepub fn add_entry(
&mut self,
label: &str,
entry_type: LegendEntryType<C>,
) -> ChartResult<()>
pub fn add_entry( &mut self, label: &str, entry_type: LegendEntryType<C>, ) -> ChartResult<()>
Add an entry to the legend
Sourcepub fn set_orientation(&mut self, orientation: LegendOrientation)
pub fn set_orientation(&mut self, orientation: LegendOrientation)
Set the legend orientation
Sourcepub fn set_style(&mut self, style: LegendStyle<C>)
pub fn set_style(&mut self, style: LegendStyle<C>)
Set the legend style
Sourcepub fn calculate_size(&self) -> Size
pub fn calculate_size(&self) -> Size
Calculate the required size for this legend
Trait Implementations§
Source§impl<C: Clone + PixelColor> Clone for DefaultLegend<C>
impl<C: Clone + PixelColor> Clone for DefaultLegend<C>
Source§fn clone(&self) -> DefaultLegend<C>
fn clone(&self) -> DefaultLegend<C>
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 moreSource§impl<C: Debug + PixelColor> Debug for DefaultLegend<C>
impl<C: Debug + PixelColor> Debug for DefaultLegend<C>
Source§impl<C: PixelColor + From<Rgb565>> Legend<C> for DefaultLegend<C>
impl<C: PixelColor + From<Rgb565>> Legend<C> for DefaultLegend<C>
Source§type Entry = DefaultLegendEntry<C>
type Entry = DefaultLegendEntry<C>
The type of legend entries this legend contains
Source§fn entries_mut(&mut self) -> &mut [Self::Entry]
fn entries_mut(&mut self) -> &mut [Self::Entry]
Get mutable access to legend entries
Source§fn remove_entry(&mut self, index: usize) -> ChartResult<()>
fn remove_entry(&mut self, index: usize) -> ChartResult<()>
Remove an entry by index
Source§fn clear_entries(&mut self)
fn clear_entries(&mut self)
Clear all entries
Source§fn position(&self) -> LegendPosition
fn position(&self) -> LegendPosition
Get the legend position
Source§fn set_position(&mut self, position: LegendPosition)
fn set_position(&mut self, position: LegendPosition)
Set the legend position
Source§fn orientation(&self) -> LegendOrientation
fn orientation(&self) -> LegendOrientation
Get the legend orientation
Source§fn set_orientation(&mut self, orientation: LegendOrientation)
fn set_orientation(&mut self, orientation: LegendOrientation)
Set the legend orientation
Source§fn calculate_size(&self) -> Size
fn calculate_size(&self) -> Size
Calculate the required size for this legend
Source§fn visible_entry_count(&self) -> usize
fn visible_entry_count(&self) -> usize
Get the number of visible entries
Auto Trait Implementations§
impl<C> Freeze for DefaultLegend<C>where
C: Freeze,
impl<C> RefUnwindSafe for DefaultLegend<C>where
C: RefUnwindSafe,
impl<C> Send for DefaultLegend<C>where
C: Send,
impl<C> Sync for DefaultLegend<C>where
C: Sync,
impl<C> Unpin for DefaultLegend<C>where
C: Unpin,
impl<C> UnwindSafe for DefaultLegend<C>where
C: UnwindSafe,
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.