Skip to main content

euv_chart/option/
enum.rs

1/// The size of a data point's symbol.
2#[derive(Clone, Copy, Debug, PartialEq)]
3pub enum SymbolSize {
4    /// The same size on both axes.
5    Uniform(f64),
6    /// A different size on each axis.
7    NonUniform(f64, f64),
8}
9
10/// ECharts data is loosely typed: a point can be a bare number, a
11/// `[name, value]` pair, or an object with named fields. The chart crate
12/// keeps the same flexibility, so an existing ECharts dataset can be
13/// ported without reshaping it.
14#[derive(Clone, Debug, Default, PartialEq)]
15pub enum DataValue {
16    /// A numeric value.
17    Number(f64),
18    /// A text value.
19    Text(String),
20    /// A boolean value.
21    Bool(bool),
22    /// An explicit null.
23    #[default]
24    Null,
25    /// A list of values.
26    List(Vec<DataValue>),
27    /// An object with named fields, in insertion order.
28    Object(Vec<(String, DataValue)>),
29}
30
31/// The kind of an axis.
32#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
33pub enum AxisType {
34    /// A category axis: the data are discrete names.
35    #[default]
36    Category,
37    /// A value axis: the data are continuous numbers.
38    Value,
39    /// A time axis: the data are timestamps.
40    Time,
41    /// A log axis: the data are continuous numbers on a logarithmic
42    /// scale.
43    Log,
44}
45
46/// Where a component sits relative to its container.
47#[derive(Clone, Copy, Debug, Default, PartialEq)]
48pub enum Position {
49    /// The top edge.
50    Top,
51    /// The vertical centre.
52    #[default]
53    Middle,
54    /// The bottom edge.
55    Bottom,
56    /// The left edge.
57    Left,
58    /// The right edge.
59    Right,
60    /// Inside the container.
61    Inside,
62    /// A distance from the edge.
63    Offset(f64),
64}
65
66/// The direction a component lays its items out in.
67#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
68pub enum Orientation {
69    /// Horizontally, left to right.
70    #[default]
71    Horizontal,
72    /// Vertically, top to bottom.
73    Vertical,
74}
75
76/// How a component picks the item a tooltip describes.
77#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
78pub enum TriggerType {
79    /// The tooltip describes the item under the pointer.
80    #[default]
81    Item,
82    /// The tooltip describes the axis under the pointer.
83    Axis,
84    /// Nothing is shown.
85    None,
86}
87
88/// The shape drawn for a data point.
89#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
90pub enum SymbolType {
91    /// A circle.
92    #[default]
93    Circle,
94    /// A rectangle.
95    Rect,
96    /// A rounded rectangle.
97    RoundRect,
98    /// A triangle.
99    Triangle,
100    /// A diamond.
101    Diamond,
102    /// A pin.
103    Pin,
104    /// An arrow.
105    Arrow,
106    /// No symbol is drawn.
107    None,
108}
109
110/// The kind of a data zoom control.
111#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
112pub enum DataZoomType {
113    /// A slider under the chart.
114    #[default]
115    Slider,
116    /// A draggable region inside the chart.
117    Inside,
118}
119
120/// The kind of a visual map.
121#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
122pub enum VisualMapType {
123    /// A continuous colour ramp.
124    #[default]
125    Continuous,
126    /// Discrete colour bands.
127    Piecewise,
128}
129
130/// The kind of a line drawn by a series.
131#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
132pub enum LineType {
133    /// A straight line between the points.
134    #[default]
135    Solid,
136    /// A dashed line.
137    Dashed,
138    /// A dotted line.
139    Dotted,
140}
141
142/// How a line series connects its points.
143#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
144pub enum LineSmooth {
145    /// Straight segments.
146    #[default]
147    None,
148    /// A smoothed curve.
149    Smooth,
150    /// A stepped curve.
151    Step,
152}
153
154/// The kind of a chart series.
155///
156/// The variant names match the ECharts `series.type` strings.
157#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
158pub enum SeriesType {
159    /// A line chart.
160    #[default]
161    Line,
162    /// A bar chart.
163    Bar,
164    /// A pie chart.
165    Pie,
166    /// A scatter chart.
167    Scatter,
168    /// A scatter chart with a ripple effect.
169    EffectScatter,
170    /// A radar chart.
171    Radar,
172    /// A gauge chart.
173    Gauge,
174    /// A funnel chart.
175    Funnel,
176    /// A heatmap chart.
177    Heatmap,
178    /// A graph chart.
179    Graph,
180    /// A treemap chart.
181    Treemap,
182    /// A sunburst chart.
183    Sunburst,
184    /// A boxplot chart.
185    Boxplot,
186    /// A candlestick chart.
187    Candlestick,
188    /// A theme-river chart.
189    ThemeRiver,
190    /// A sankey chart.
191    Sankey,
192    /// A parallel-coordinates chart.
193    Parallel,
194    /// A pictorial bar chart.
195    PictorialBar,
196    /// A lines chart.
197    Lines,
198    /// A map chart.
199    Map,
200    /// A chart driven by a custom renderer.
201    Custom,
202}
203
204/// The kind of a dataset source.
205#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
206pub enum DatasetSourceType {
207    /// A two-dimensional array of values.
208    #[default]
209    Array,
210    /// An object keyed by dimension.
211    Object,
212    /// A list of rows, each an object.
213    Rows,
214    /// A list of rows, each a list of values.
215    Columns,
216}
217
218/// How a mark line is drawn.
219#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
220pub enum MarkLineType {
221    /// A horizontal line at a value.
222    #[default]
223    Average,
224    /// A horizontal line at a value.
225    Min,
226    /// A horizontal line at a value.
227    Max,
228    /// A line between two data points.
229    Start,
230    /// A line between two data points.
231    End,
232    /// A difference between two values.
233    Difference,
234}
235
236/// The layout of a treemap.
237#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
238pub enum TreemapLayout {
239    /// The classic slice-and-dice layout.
240    #[default]
241    SliceAndDice,
242    /// A squarified layout.
243    Squarify,
244}
245
246/// The kind of a graph layout.
247#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
248pub enum GraphLayout {
249    /// No layout is applied; the positions come from the data.
250    #[default]
251    None,
252    /// A force-directed layout.
253    Force,
254    /// A circular layout.
255    Circular,
256}
257
258/// The shape of a gauge's progress arc.
259#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
260pub enum GaugeProgressType {
261    /// A solid arc.
262    #[default]
263    Solid,
264    /// A striped arc.
265    Stripe,
266}