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 raster;
27pub mod rect;
28pub mod refline;
29pub mod ribbon;
30pub mod rug;
31pub mod segment;
32pub mod smooth;
33pub mod spoke;
34pub mod step;
35pub mod text;
36pub mod tile;
37pub mod violin;
38
39use std::collections::HashMap;
40
41use crate::aes::Aesthetic;
42use crate::coord::Coord;
43use crate::data::DataFrame;
44use crate::position::Position;
45use crate::render::backend::DrawBackend;
46use crate::render::RenderError;
47use crate::scale::ScaleSet;
48use crate::stat::Stat;
49use crate::theme::Theme;
50
51#[derive(Clone, Debug, Default)]
53pub struct GeomParams {
54 pub values: HashMap<String, f64>,
55 pub color: Option<(u8, u8, u8)>,
56 pub fill: Option<(u8, u8, u8)>,
57 pub alpha: Option<f64>,
58}
59
60pub trait Geom: Send + Sync {
62 fn draw(
64 &self,
65 data: &DataFrame,
66 coord: &dyn Coord,
67 scales: &ScaleSet,
68 theme: &Theme,
69 backend: &mut dyn DrawBackend,
70 ) -> Result<(), RenderError>;
71
72 fn required_aes(&self) -> Vec<Aesthetic>;
74
75 fn default_stat(&self) -> Box<dyn Stat>;
77
78 fn default_position(&self) -> Box<dyn Position>;
80
81 fn default_params(&self) -> GeomParams;
83
84 fn name(&self) -> &str;
86
87 fn set_series_color(&mut self, _color: (u8, u8, u8)) {}
92}