LegendEntry

Trait LegendEntry 

Source
pub trait LegendEntry<C: PixelColor> {
    // Required methods
    fn label(&self) -> &str;
    fn set_label(&mut self, label: &str) -> ChartResult<()>;
    fn entry_type(&self) -> &LegendEntryType<C>;
    fn set_entry_type(&mut self, entry_type: LegendEntryType<C>);
    fn is_visible(&self) -> bool;
    fn set_visible(&mut self, visible: bool);
    fn calculate_size(&self, style: &LegendStyle<C>) -> Size;
    fn render_symbol<D>(
        &self,
        bounds: Rectangle,
        style: &SymbolStyle<C>,
        target: &mut D,
    ) -> ChartResult<()>
       where D: DrawTarget<Color = C>;
}
Expand description

Trait for individual legend entries

Required Methods§

Source

fn label(&self) -> &str

Get the label text for this entry

Source

fn set_label(&mut self, label: &str) -> ChartResult<()>

Set the label text for this entry

Source

fn entry_type(&self) -> &LegendEntryType<C>

Get the entry type (determines the symbol)

Source

fn set_entry_type(&mut self, entry_type: LegendEntryType<C>)

Set the entry type

Source

fn is_visible(&self) -> bool

Check if this entry is visible

Source

fn set_visible(&mut self, visible: bool)

Set the visibility of this entry

Source

fn calculate_size(&self, style: &LegendStyle<C>) -> Size

Calculate the required size for this entry

Source

fn render_symbol<D>( &self, bounds: Rectangle, style: &SymbolStyle<C>, target: &mut D, ) -> ChartResult<()>
where D: DrawTarget<Color = C>,

Render the symbol for this entry

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§