1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! Plot configuration types
/// Backend types for rendering
#[allow(clippy::upper_case_acronyms)] // GPU is the standard industry acronym
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BackendType {
/// Default Skia backend (CPU-based, good for <1K points)
Skia,
/// Parallel multi-threaded backend (good for 1K-100K points)
Parallel,
/// GPU-accelerated backend (good for >100K points)
GPU,
/// DataShader aggregation backend (good for >1M points)
DataShader,
}
/// Tick direction configuration
#[derive(Clone, Debug, PartialEq, Default)]
pub enum TickDirection {
/// Ticks point inward into the plot area (default)
#[default]
Inside,
/// Ticks point outward from the plot area
Outside,
/// Ticks straddle the plot border, extending both in and out
InOut,
}
/// Tick side visibility configuration
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct TickSides {
/// Show ticks on the top border of the plot area.
pub top: bool,
/// Show ticks on the bottom border of the plot area.
pub bottom: bool,
/// Show ticks on the left border of the plot area.
pub left: bool,
/// Show ticks on the right border of the plot area.
pub right: bool,
}
impl TickSides {
/// Show ticks on no sides.
pub const fn none() -> Self {
Self {
top: false,
bottom: false,
left: false,
right: false,
}
}
/// Show ticks on all four sides.
pub const fn all() -> Self {
Self {
top: true,
bottom: true,
left: true,
right: true,
}
}
/// Show ticks only on the bottom and left sides.
pub const fn bottom_left() -> Self {
Self {
top: false,
bottom: true,
left: true,
right: false,
}
}
/// Return a copy with top ticks enabled or disabled.
pub const fn with_top(mut self, enabled: bool) -> Self {
self.top = enabled;
self
}
/// Return a copy with bottom ticks enabled or disabled.
pub const fn with_bottom(mut self, enabled: bool) -> Self {
self.bottom = enabled;
self
}
/// Return a copy with left ticks enabled or disabled.
pub const fn with_left(mut self, enabled: bool) -> Self {
self.left = enabled;
self
}
/// Return a copy with right ticks enabled or disabled.
pub const fn with_right(mut self, enabled: bool) -> Self {
self.right = enabled;
self
}
}
impl Default for TickSides {
fn default() -> Self {
Self::all()
}
}
/// Grid display mode for major and minor ticks
#[derive(Clone, Debug, PartialEq, Default)]
pub enum GridMode {
/// Show grid lines only at major ticks
#[default]
MajorOnly,
/// Show grid lines only at minor ticks
MinorOnly,
/// Show grid lines at both major and minor ticks
Both,
}