pub struct Legend {
pub text_style: TextStyle,
pub background_alpha: f32,
pub position: Corner,
pub title: Option<String>,
/* private fields */
}Expand description
The configuration for a plot legend.
Fields§
§text_style: TextStyle§background_alpha: f32§position: Corner§title: Option<String>Implementations§
Source§impl Legend
impl Legend
Sourcepub fn text_style(self, style: TextStyle) -> Self
pub fn text_style(self, style: TextStyle) -> Self
Which text style to use for the legend. Default: TextStyle::Body.
Sourcepub fn background_alpha(self, alpha: f32) -> Self
pub fn background_alpha(self, alpha: f32) -> Self
The alpha of the legend background. Default: 0.75.
Sourcepub fn position(self, corner: Corner) -> Self
pub fn position(self, corner: Corner) -> Self
In which corner to place the legend. Default: Corner::RightTop.
Specifies hidden items in the legend configuration to override the existing ones. This allows the legend traces’ visibility to be controlled from the application code.
Sourcepub fn follow_insertion_order(self, follow: bool) -> Self
pub fn follow_insertion_order(self, follow: bool) -> Self
Specifies if the legend item order should be the inserted order.
Default: false.
If true, the order of the legend items will be the same as the order as they were added.
By default it will be sorted alphabetically.
Sourcepub fn color_conflict_handling(
self,
color_conflict_handling: ColorConflictHandling,
) -> Self
pub fn color_conflict_handling( self, color_conflict_handling: ColorConflictHandling, ) -> Self
Specifies how to handle conflicting colors for an item.
Sourcepub fn grouping(self, grouping: LegendGrouping) -> Self
pub fn grouping(self, grouping: LegendGrouping) -> Self
Specifies how legend entries are grouped. Default: LegendGrouping::ByName.
With LegendGrouping::ByName, items sharing the same name are
merged into a single legend entry. With LegendGrouping::ById,
each item gets its own entry keyed by its unique Id.