Skip to main content

euv_chart/series/
struct.rs

1use super::*;
2
3/// Draws the series of a chart into the display list.
4///
5/// The renderer builds the *paths* of the series; turning them into
6/// triangles is the backend's job, because each backend has its own
7/// way of getting geometry onto the screen.
8#[derive(Clone, Debug)]
9pub struct SeriesRenderer {}
10
11/// A node of a graph series.
12#[derive(Clone, Debug)]
13pub(crate) struct GraphNode {
14    /// The name of the node.
15    pub name: String,
16    /// The value of the node.
17    pub value: f64,
18    /// The horizontal position of the node.
19    pub x: f64,
20    /// The vertical position of the node.
21    pub y: f64,
22    /// The size of the node's symbol.
23    pub size: f64,
24}
25
26/// A link between two nodes of a graph series.
27#[derive(Clone, Debug)]
28pub(crate) struct GraphLink {
29    /// The name of the node the link starts at.
30    pub source: String,
31    /// The name of the node the link ends at.
32    pub target: String,
33    /// The value of the link.
34    pub value: f64,
35}
36
37/// The geometry of a radar coordinate system.
38#[derive(Clone, Copy, Data, Debug)]
39pub(crate) struct RadarGeometry {
40    /// The centre of the radar.
41    #[get(type(copy))]
42    pub center_x: f64,
43    /// The centre of the radar.
44    #[get(type(copy))]
45    pub center_y: f64,
46    /// The radius of the radar.
47    #[get(type(copy))]
48    pub radius: f64,
49    /// The number of sides of the radar.
50    #[get(type(copy))]
51    pub sides: usize,
52    /// The angle the first side starts at, in radians.
53    #[get(type(copy))]
54    pub start_angle: f64,
55}
56
57/// A node of a sankey series.
58#[derive(Clone, Debug)]
59pub(crate) struct SankeyNode {
60    /// The name of the node.
61    pub name: String,
62    /// The value of the node.
63    pub value: f64,
64    /// The column the node sits in.
65    pub column: usize,
66    /// The vertical position of the node's top edge.
67    pub top: f64,
68    /// The height of the node.
69    pub height: f64,
70}
71
72/// A link of a sankey series.
73#[derive(Clone, Debug)]
74pub(crate) struct SankeyLink {
75    /// The name of the node the link starts at.
76    pub source: String,
77    /// The name of the node the link ends at.
78    pub target: String,
79    /// The value of the link.
80    pub value: f64,
81}
82
83/// A sector of a sunburst.
84#[derive(Clone, Debug)]
85pub(crate) struct SunburstSector {
86    /// The name of the sector.
87    pub name: String,
88    /// The value of the sector.
89    pub value: f64,
90    /// The ring the sector is drawn in.
91    pub depth: usize,
92    /// The angle the sector starts at, in radians.
93    pub start_angle: f64,
94    /// The angle the sector ends at, in radians.
95    pub end_angle: f64,
96}
97
98/// A tile of a treemap.
99#[derive(Clone, Debug)]
100pub(crate) struct TreeTile {
101    /// The name of the tile.
102    pub name: String,
103    /// The value of the tile.
104    pub value: f64,
105    /// The rectangle the tile occupies.
106    pub rect: BBox,
107    /// The depth of the tile in the hierarchy.
108    pub depth: usize,
109}