euv_ui/component/chart/scale/struct.rs
1use super::*;
2
3/// Resolved numeric, category, time, or logarithmic axis scale ready for pixel projection.
4#[derive(Clone, Data, Debug, PartialEq)]
5pub struct EuvChartAxisScale {
6 /// Active axis scale kind (`Category`, `Value`, `Time`, `Log`).
7 #[get(type(copy))]
8 pub(crate) axis_type: EuvChartAxisType,
9 /// Resolved lower domain bound (numeric or category start index).
10 #[get(type(copy))]
11 pub(crate) min: f32,
12 /// Resolved upper domain bound (numeric or category end index).
13 #[get(type(copy))]
14 pub(crate) max: f32,
15 /// Whether projection direction is inverted.
16 #[get(type(copy))]
17 pub(crate) inverse: bool,
18 /// Ordered tick domain values (or category indices).
19 pub(crate) ticks: Vec<f32>,
20 /// Pre-formatted tick labels aligned 1:1 with `ticks`.
21 pub(crate) labels: Vec<String>,
22 /// Visible category labels (sliced by active `DataZoom` window when applicable).
23 pub(crate) categories: Vec<String>,
24 /// Continuous lower category index bound for fractional DataZoom panning (`0.0` when unzoomed).
25 #[get(type(copy))]
26 pub(crate) window_start: f32,
27 /// Continuous visible category slot span (`0.0` falls back to `categories.len()`).
28 #[get(type(copy))]
29 pub(crate) window_span: f32,
30 /// Global category index corresponding to `categories[0]`.
31 #[get(type(copy))]
32 pub(crate) category_base_index: usize,
33}
34
35/// Active index/percentage slice window computed from `DataZoom` state.
36#[derive(Clone, Copy, Data, Debug, PartialEq)]
37pub struct EuvChartZoomSlice {
38 /// Lower window percentage in `[0.0, 100.0]`.
39 #[get(type(copy))]
40 pub(crate) start_pct: f32,
41 /// Upper window percentage in `[0.0, 100.0]`.
42 #[get(type(copy))]
43 pub(crate) end_pct: f32,
44 /// Inclusive first category/sample index inside the zoomed slice.
45 #[get(type(copy))]
46 pub(crate) start_index: usize,
47 /// Exclusive upper category/sample index inside the zoomed slice.
48 #[get(type(copy))]
49 pub(crate) end_index: usize,
50 /// Continuous fractional lower category index in `[0.0, total_len]`.
51 #[get(type(copy))]
52 pub(crate) start_f: f32,
53 /// Continuous fractional upper category index in `[0.0, total_len]`.
54 #[get(type(copy))]
55 pub(crate) end_f: f32,
56}
57
58/// Resolved visual-map color evaluator supporting `Continuous` and `Piecewise` modes.
59#[derive(Clone, Data, Debug, PartialEq)]
60pub struct EuvChartVisualEvaluator {
61 /// Active mapping mode (`Continuous` or `Piecewise`).
62 #[get(type(copy))]
63 pub(crate) kind: EuvChartVisualMapKind,
64 /// Lower numeric domain value.
65 #[get(type(copy))]
66 pub(crate) min: f32,
67 /// Upper numeric domain value.
68 #[get(type(copy))]
69 pub(crate) max: f32,
70 /// Ordered continuous gradient stops (guaranteed non-empty).
71 pub(crate) stops: Vec<Color>,
72 /// Discrete piecewise range buckets.
73 pub(crate) pieces: Vec<EuvChartVisualPiece>,
74}