Skip to main content

plotlars_core/components/
line.rs

1/// An enumeration representing different styles of lines that can be used in plots.
2///
3/// # Example
4///
5/// ```rust
6/// use polars::prelude::*;
7/// use plotlars::{Legend, Line, Plot, Rgb, TimeSeriesPlot};
8///
9/// let dataset = LazyCsvReader::new(PlRefPath::new("data/revenue_and_cost.csv"))
10///     .finish()
11///     .unwrap()
12///     .select([
13///         col("Date").cast(DataType::String),
14///         col("Revenue").cast(DataType::Int32),
15///         col("Cost").cast(DataType::Int32),
16///     ])
17///     .collect()
18///     .unwrap();
19///
20/// TimeSeriesPlot::builder()
21///     .data(&dataset)
22///     .x("Date")
23///     .y("Revenue")
24///     .additional_series(vec!["Cost"])
25///     .size(8)
26///     .colors(vec![Rgb(255, 0, 0), Rgb(0, 255, 0)])
27///     .lines(vec![Line::Dash, Line::Solid])
28///     .legend(
29///         &Legend::new()
30///             .x(0.05)
31///             .y(0.9)
32///     )
33///     .build()
34///     .plot();
35/// ```
36///
37/// ![Example](https://imgur.com/y6ZyypZ.png)
38#[derive(Clone, Copy)]
39pub enum Line {
40    Solid,
41    Dot,
42    Dash,
43    LongDash,
44    DashDot,
45    LongDashDot,
46}