crisol_plot/plot/
chart_config.rs1use egui::Color32;
4
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11#[derive(Clone, Copy, Debug, PartialEq)]
12pub struct DirectionArrowConfig {
13 pub enabled: bool,
15 pub points: usize,
17 pub length: f32,
19 pub width: f32,
21 pub head: f32,
23 pub color: Option<Color32>,
25}
26
27impl Default for DirectionArrowConfig {
28 fn default() -> Self {
29 Self {
30 enabled: false,
31 points: 5,
32 length: 26.0,
33 width: 2.0,
34 head: 8.0,
35 color: None,
36 }
37 }
38}
39
40#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
41#[derive(Clone, Copy, Debug, PartialEq)]
43pub struct PieConfig {
44 pub inner_radius: f32,
46 pub start_angle: f32,
48 pub labels: bool,
50 pub percentages: bool,
52 pub total: bool,
54}
55
56impl Default for PieConfig {
57 fn default() -> Self {
58 Self {
59 inner_radius: 0.0,
60 start_angle: -std::f32::consts::FRAC_PI_2,
61 labels: true,
62 percentages: true,
63 total: true,
64 }
65 }
66}
67
68#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
69#[derive(Clone, Debug, PartialEq)]
71pub struct RadarConfig {
72 pub labels: Vec<String>,
74 pub max: Option<f64>,
76 pub rings: u8,
78 pub fill_opacity: f32,
80}
81
82impl Default for RadarConfig {
83 fn default() -> Self {
84 Self {
85 labels: Vec::new(),
86 max: None,
87 rings: 4,
88 fill_opacity: 0.16,
89 }
90 }
91}
92
93impl RadarConfig {
94 pub fn new(labels: impl IntoIterator<Item = impl Into<String>>) -> Self {
96 Self {
97 labels: labels.into_iter().map(Into::into).collect(),
98 ..Self::default()
99 }
100 }
101}
102
103#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
104#[derive(Clone, Copy, Debug, PartialEq)]
106pub struct GaugeConfig {
107 pub start_angle: f32,
109 pub end_angle: f32,
111 pub thickness: f32,
113 pub show_value: bool,
115 pub show_range: bool,
117}
118
119impl Default for GaugeConfig {
120 fn default() -> Self {
121 Self {
122 start_angle: 0.75 * std::f32::consts::PI,
123 end_angle: 2.25 * std::f32::consts::PI,
124 thickness: 10.0,
125 show_value: true,
126 show_range: true,
127 }
128 }
129}
130
131#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
132#[derive(Clone, Copy, Debug, PartialEq)]
134pub struct HeatmapConfig {
135 pub opacity: f32,
137 pub colorbar: bool,
139 pub colormap: super::Colormap,
141}
142
143impl Default for HeatmapConfig {
144 fn default() -> Self {
145 Self {
146 opacity: 1.0,
147 colorbar: true,
148 colormap: super::Colormap::Theme,
149 }
150 }
151}
152
153#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
154#[derive(Clone, Copy, Debug, PartialEq)]
156pub struct WaterfallConfig {
157 pub bar_width: Option<f64>,
159 pub connectors: bool,
161}
162
163impl Default for WaterfallConfig {
164 fn default() -> Self {
165 Self {
166 bar_width: None,
167 connectors: true,
168 }
169 }
170}