plotting/line_style.rs
1use plotly::common::DashType;
2
3/// Line style.
4///
5/// # Note
6///
7/// This enum is a direct re-implementation of the [`DashType`] enum from the [`plotly`] crate (Ref.
8/// \[1\]). As such, we have included the license of the [`plotly`] crate in the
9/// [`src/plotly_licenses`](https://github.com/tamaskis/plotting/tree/main/src/plotly_licenses/LICENSE)
10/// folder.
11///
12/// # References
13///
14/// * \[1\] <https://docs.rs/plotly/latest/plotly/common/enum.DashType.html>
15#[derive(Clone, Copy)]
16pub enum LineStyle {
17 /// Solid line.
18 Solid,
19
20 /// Dotted line.
21 Dot,
22
23 /// Dashed line.
24 Dash,
25
26 /// Long dashed line.
27 LongDash,
28
29 /// Dashed line with dots.
30 DashDot,
31
32 /// Long dashed line with dots.
33 LongDashDot,
34}
35
36impl From<LineStyle> for DashType {
37 fn from(style: LineStyle) -> Self {
38 match style {
39 LineStyle::Solid => DashType::Solid,
40 LineStyle::Dot => DashType::Dot,
41 LineStyle::Dash => DashType::Dash,
42 LineStyle::LongDash => DashType::LongDash,
43 LineStyle::DashDot => DashType::DashDot,
44 LineStyle::LongDashDot => DashType::LongDashDot,
45 }
46 }
47}