pub trait Legend<C: PixelColor> {
type Entry: LegendEntry<C>;
// Required methods
fn entries(&self) -> &[Self::Entry];
fn entries_mut(&mut self) -> &mut [Self::Entry];
fn add_entry(&mut self, entry: Self::Entry) -> ChartResult<()>;
fn remove_entry(&mut self, index: usize) -> ChartResult<()>;
fn clear_entries(&mut self);
fn position(&self) -> LegendPosition;
fn set_position(&mut self, position: LegendPosition);
fn orientation(&self) -> LegendOrientation;
fn set_orientation(&mut self, orientation: LegendOrientation);
fn calculate_size(&self) -> Size;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn visible_entry_count(&self) -> usize { ... }
}Expand description
Main trait for legend implementations
Required Associated Types§
Sourcetype Entry: LegendEntry<C>
type Entry: LegendEntry<C>
The type of legend entries this legend contains
Required Methods§
Sourcefn entries_mut(&mut self) -> &mut [Self::Entry]
fn entries_mut(&mut self) -> &mut [Self::Entry]
Get mutable access to legend entries
Sourcefn add_entry(&mut self, entry: Self::Entry) -> ChartResult<()>
fn add_entry(&mut self, entry: Self::Entry) -> ChartResult<()>
Add a new entry to the legend
Sourcefn remove_entry(&mut self, index: usize) -> ChartResult<()>
fn remove_entry(&mut self, index: usize) -> ChartResult<()>
Remove an entry by index
Sourcefn clear_entries(&mut self)
fn clear_entries(&mut self)
Clear all entries
Sourcefn position(&self) -> LegendPosition
fn position(&self) -> LegendPosition
Get the legend position
Sourcefn set_position(&mut self, position: LegendPosition)
fn set_position(&mut self, position: LegendPosition)
Set the legend position
Sourcefn orientation(&self) -> LegendOrientation
fn orientation(&self) -> LegendOrientation
Get the legend orientation
Sourcefn set_orientation(&mut self, orientation: LegendOrientation)
fn set_orientation(&mut self, orientation: LegendOrientation)
Set the legend orientation
Sourcefn calculate_size(&self) -> Size
fn calculate_size(&self) -> Size
Calculate the required size for this legend
Provided Methods§
Sourcefn visible_entry_count(&self) -> usize
fn visible_entry_count(&self) -> usize
Get the number of visible entries