1pub mod area;
2pub mod bar;
3pub mod bin2d;
4pub mod blank;
5pub mod boxplot;
6pub mod col;
7pub mod contour;
8pub mod count;
9pub mod crossbar;
10pub mod curve;
11pub mod density;
12pub mod density2d;
13pub mod dotplot;
14pub mod errorbar;
15pub mod freqpoly;
16pub mod hex;
17pub mod histogram;
18pub mod jitter;
19pub mod line;
20pub mod linerange;
21pub mod path;
22pub mod point;
23pub mod pointrange;
24pub mod polygon;
25pub mod qq;
26pub mod rect;
27pub mod refline;
28pub mod ribbon;
29pub mod rug;
30pub mod segment;
31pub mod smooth;
32pub mod spoke;
33pub mod step;
34pub mod text;
35pub mod tile;
36pub mod violin;
37
38use std::collections::HashMap;
39
40use crate::aes::Aesthetic;
41use crate::coord::Coord;
42use crate::data::DataFrame;
43use crate::position::Position;
44use crate::render::backend::DrawBackend;
45use crate::render::RenderError;
46use crate::scale::ScaleSet;
47use crate::stat::Stat;
48use crate::theme::Theme;
49
50#[derive(Clone, Debug, Default)]
52pub struct GeomParams {
53 pub values: HashMap<String, f64>,
54 pub color: Option<(u8, u8, u8)>,
55 pub fill: Option<(u8, u8, u8)>,
56 pub alpha: Option<f64>,
57}
58
59pub trait Geom: Send + Sync {
61 fn draw(
63 &self,
64 data: &DataFrame,
65 coord: &dyn Coord,
66 scales: &ScaleSet,
67 theme: &Theme,
68 backend: &mut dyn DrawBackend,
69 ) -> Result<(), RenderError>;
70
71 fn required_aes(&self) -> Vec<Aesthetic>;
73
74 fn default_stat(&self) -> Box<dyn Stat>;
76
77 fn default_position(&self) -> Box<dyn Position>;
79
80 fn default_params(&self) -> GeomParams;
82
83 fn name(&self) -> &str;
85
86 fn set_series_color(&mut self, _color: (u8, u8, u8)) {}
91}