gpui_component/plot/
scale.rs

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