gpui_component/plot/scale.rs
1mod band;
2mod linear;
3mod ordinal;
4mod point;
5mod sealed;
6
7pub use band::ScaleBand;
8pub use linear::ScaleLinear;
9pub use ordinal::ScaleOrdinal;
10pub use point::ScalePoint;
11pub(crate) use sealed::Sealed;
12
13pub trait Scale<T> {
14 /// Get the tick of the scale.
15 fn tick(&self, value: &T) -> Option<f32>;
16
17 /// Get the least index of the scale.
18 fn least_index(&self, _tick: f32) -> usize {
19 0
20 }
21
22 /// Get the least index of the scale with the domain.
23 fn least_index_with_domain(&self, _tick: f32, _domain: &[T]) -> (usize, f32) {
24 (0, 0.)
25 }
26}