Skip to main content

fission_charts/components/
axis_pointer.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4pub enum AxisPointerType {
5    Line,
6    Shadow,
7    Cross,
8}
9
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11pub struct AxisPointer {
12    pub pointer_type: AxisPointerType,
13    pub snap: bool,
14}
15
16impl Default for AxisPointer {
17    fn default() -> Self {
18        Self {
19            pointer_type: AxisPointerType::Line,
20            snap: false,
21        }
22    }
23}
24
25impl AxisPointer {
26    pub fn new() -> Self {
27        Self::default()
28    }
29
30    pub fn pointer_type(mut self, pointer_type: AxisPointerType) -> Self {
31        self.pointer_type = pointer_type;
32        self
33    }
34
35    pub fn snap(mut self, snap: bool) -> Self {
36        self.snap = snap;
37        self
38    }
39}