Skip to main content

optionstratlib_visualization/visualization/
styles.rs

1use serde::{Deserialize, Serialize};
2
3/// Represents the visual style of a line in graphical elements.
4///
5/// This enum defines different line styles that can be used when drawing lines
6/// in graphics contexts, charts, or UI elements.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
8#[serde(rename_all = "snake_case")]
9#[repr(u8)]
10pub enum LineStyle {
11    /// A continuous unbroken line (default style).
12    #[default]
13    Solid,
14    /// A line composed of small dots.
15    Dotted,
16    /// A line composed of longer segments with gaps.
17    Dashed,
18}
19
20/// Represents the color scheme used for visualizations.
21///
22/// This enum defines various color schemes that can be applied to charts, graphs,
23/// or any visual elements that require color differentiation.
24#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
25#[serde(rename_all = "snake_case")]
26pub enum ColorScheme {
27    /// Default color scheme, used when no specific scheme is selected.
28    #[default]
29    Default,
30
31    /// Viridis color scheme - a perceptually uniform color map designed to be
32    /// perceived by viewers with common forms of color blindness.
33    Viridis,
34
35    /// Plasma color scheme - a perceptually uniform color map with a purple-orange gradient.
36    Plasma,
37
38    /// Custom color scheme defined by a vector of color strings.
39    /// Each string should represent a valid color (e.g., hex code, RGB, color name).
40    Custom(Vec<String>),
41
42    /// White color scheme - primarily white or light colors.
43    White,
44
45    /// High contrast color scheme - designed for maximum visibility and accessibility.
46    HighContrast,
47}
48
49/// Defines the visual appearance of traces in plots.
50///
51/// This enum specifies how data points should be displayed in a visualization,
52/// such as connecting points with lines, showing individual markers, or both.
53#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
54#[serde(rename_all = "snake_case")]
55#[repr(u8)]
56pub enum TraceMode {
57    /// Display points connected by lines only.
58    #[default]
59    Lines,
60    /// Display individual markers only without connecting lines.
61    Markers,
62    /// Display both lines connecting points and individual markers.
63    LinesMarkers,
64    /// Display text labels at points.
65    TextLabels,
66}
67
68/// Represents different types of plots that can be generated.
69///
70/// This enum defines the various plot visualization types supported by the system.
71/// Each variant corresponds to a specific visualization method for data representation.
72///
73#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
74#[serde(rename_all = "snake_case")]
75#[repr(u8)]
76pub enum PlotType {
77    /// 2D line plot
78    #[default]
79    Line2D,
80    /// 2D scatter plot with individual points
81    Scatter2D,
82    /// 3D surface plot for visualizing 3D data
83    Surface3D,
84    /// Heat map visualization for representing data density or intensity
85    Heatmap,
86}