use std::sync::Arc;
use crate::plot::scatter::MarkerShape;
#[derive(Clone)]
pub struct LegendEntry {
pub label: String,
pub color: String,
pub shape: LegendShape, pub dasharray: Option<String>,
}
#[derive(Clone, Copy)]
pub enum LegendShape {
Rect,
Line,
Circle,
Marker(MarkerShape),
CircleSize(f64), }
#[derive(Clone)]
pub struct LegendGroup {
pub title: String,
pub entries: Vec<LegendEntry>,
}
pub struct Legend {
pub title: Option<String>,
pub entries: Vec<LegendEntry>,
pub groups: Option<Vec<LegendGroup>>,
pub position: LegendPosition,
pub show_box: bool,
}
impl Default for Legend {
fn default() -> Self {
Self {
title: None,
entries: Vec::new(),
groups: None,
position: LegendPosition::default(),
show_box: true,
}
}
}
#[derive(Default, Clone, Copy)]
pub enum LegendPosition {
InsideTopRight,
InsideTopLeft,
InsideBottomRight,
InsideBottomLeft,
InsideTopCenter,
InsideBottomCenter,
#[default]
OutsideRightTop,
OutsideRightMiddle,
OutsideRightBottom,
OutsideLeftTop,
OutsideLeftMiddle,
OutsideLeftBottom,
OutsideTopLeft,
OutsideTopCenter,
OutsideTopRight,
OutsideBottomLeft,
OutsideBottomCenter,
OutsideBottomRight,
Custom(f64, f64),
DataCoords(f64, f64),
}
pub struct ColorBarInfo {
pub map_fn: Arc<dyn Fn(f64) -> String + Send + Sync>,
pub min_value: f64,
pub max_value: f64,
pub label: Option<String>,
}