plotlars_core/components/fill.rs
1/// An enumeration representing different fill modes for area traces in plots.
2///
3/// The `Fill` enum specifies how the area under or between traces should be filled
4/// in plots like scatter plots, line plots, and polar scatter plots.
5///
6/// # Example
7///
8/// ```rust
9/// use plotlars::{Fill, Mode, Plot, Rgb, ScatterPolar, Text};
10/// use polars::prelude::*;
11///
12/// let angles: Vec<f64> = (0..=360).step_by(10).map(|x| x as f64).collect();
13/// let radii: Vec<f64> = angles.iter()
14/// .map(|&angle| 5.0 + 3.0 * (angle * std::f64::consts::PI / 180.0).sin())
15/// .collect();
16///
17/// let dataset = DataFrame::new(angles.len(), vec![
18/// Column::new("angle".into(), angles),
19/// Column::new("radius".into(), radii),
20/// ])
21/// .unwrap();
22///
23/// ScatterPolar::builder()
24/// .data(&dataset)
25/// .theta("angle")
26/// .r("radius")
27/// .mode(Mode::Lines)
28/// .fill(Fill::ToSelf) // Fill the area enclosed by the trace
29/// .color(Rgb(135, 206, 250))
30/// .opacity(0.6)
31/// .plot_title(Text::from("Filled Polar Area Chart"))
32/// .build()
33/// .plot();
34/// ```
35///
36/// 
37#[derive(Clone, Copy)]
38pub enum Fill {
39 /// Fill area from the trace to y=0 (horizontal axis)
40 ToZeroY,
41 /// Fill area from the trace to x=0 (vertical axis)
42 ToZeroX,
43 /// Fill area between this trace and the next trace along the y-direction
44 ToNextY,
45 /// Fill area between this trace and the next trace along the x-direction
46 ToNextX,
47 /// Fill the area enclosed by the trace (connecting the last point to the first)
48 ToSelf,
49 /// Fill area between this trace and the next trace
50 ToNext,
51 /// Do not fill any area
52 None,
53}