Skip to main content

euv_ui/component/chart/view/
struct.rs

1use super::*;
2
3/// Props for the [`euv_chart`] component.
4///
5/// The container carries the identifier that ties the plot to its
6/// colours and the configuration that names every series in it. Each
7/// entry of the configuration pairs a series with the colour it is
8/// drawn in, and the colour is written into a custom property the plot
9/// reads.
10///
11/// The plot itself is passed as children.
12#[derive(Clone, CustomDebug, Default)]
13pub struct EuvChartProps {
14    /// The identifier that ties the plot to its colours.
15    pub id: &'static str,
16    /// The colour of every series in the chart.
17    ///
18    /// Each entry pairs the name of a series with the colour it is
19    /// drawn in. The colour is a CSS value, so a theme token such as
20    /// `var(--primary)` follows the theme.
21    pub config: Vec<(&'static str, &'static str)>,
22}
23
24/// Props for the [`euv_chart_tooltip_item`] component.
25///
26/// The row of the tooltip carries the name of a series, the value it
27/// holds at the point the reader is looking at, and the colour the
28/// series is drawn in.
29#[derive(Clone, CustomDebug, Default)]
30pub struct EuvChartTooltipItemProps {
31    /// The name of the series.
32    pub name: &'static str,
33    /// The value the series holds.
34    pub value: &'static str,
35    /// The colour the series is drawn in.
36    pub color: &'static str,
37}
38
39/// Props for the [`euv_chart_legend_item`] component.
40///
41/// The legend entry carries the name of a series and the colour it is
42/// drawn in.
43#[derive(Clone, CustomDebug, Default)]
44pub struct EuvChartLegendItemProps {
45    /// The name of the series.
46    pub label: &'static str,
47    /// The colour the series is drawn in.
48    pub color: &'static str,
49}
50
51/// Props for the [`euv_chart_tooltip`] component.
52///
53/// The tooltip holds the rows of the point and takes no settings of
54/// its own.
55#[derive(Clone, CustomDebug, Default)]
56pub struct EuvChartTooltipProps {}
57
58/// Props for the [`euv_chart_tooltip_label`] component.
59///
60/// The label holds the name of the point and takes no settings.
61#[derive(Clone, CustomDebug, Default)]
62pub struct EuvChartTooltipLabelProps {}
63
64/// Props for the [`euv_chart_legend`] component.
65///
66/// The legend holds the entries of the key and takes no settings of
67/// its own.
68#[derive(Clone, CustomDebug, Default)]
69pub struct EuvChartLegendProps {}
70
71/// Props for the [`euv_chart_container`] component.
72///
73/// The container is the box the plot is drawn in. It carries the
74/// identifier that ties the plot to its colours and the configuration
75/// that names every series in it, and the colour of each series is
76/// written into a custom property the plot reads.
77///
78/// The plot itself is passed as children.
79#[derive(Clone, CustomDebug, Default)]
80pub struct EuvChartContainerProps {
81    /// The identifier that ties the plot to its colours.
82    pub id: &'static str,
83    /// The colour of every series in the chart.
84    ///
85    /// Each entry pairs the name of a series with the colour it is
86    /// drawn in. The colour is a CSS value, so a theme token such as
87    /// `var(--primary)` follows the theme.
88    pub config: Vec<(&'static str, &'static str)>,
89}
90
91/// Props for the [`euv_chart_tooltip_content`] component.
92///
93/// The floating body of a tooltip holds the rows of the point and takes
94/// no settings of its own.
95#[derive(Clone, CustomDebug, Default)]
96pub struct EuvChartTooltipContentProps {}
97
98/// Props for the [`euv_chart_legend_content`] component.
99///
100/// The body of the key holds one entry per series and takes no settings
101/// of its own.
102#[derive(Clone, CustomDebug, Default)]
103pub struct EuvChartLegendContentProps {}