## Description - Add `stack` shape. - Add `ordinal` scale. - Add plot docs. <img width="337" height="424" alt="SCR-20251126-puzm" src="https://github.com/user-attachments/assets/eff9e2d0-c13a-449a-b717-9568e0c2f88d" /> ## Breaking change The bar shape `y0` value is now returned for each data item. ```diff - Bar::new().y0(height) + Bar::new().y0(move |_| height) + Bar::new().y0(move |d| d.height) ```
26 lines
579 B
Rust
26 lines
579 B
Rust
mod band;
|
|
mod linear;
|
|
mod ordinal;
|
|
mod point;
|
|
mod sealed;
|
|
|
|
pub use band::ScaleBand;
|
|
pub use linear::ScaleLinear;
|
|
pub use ordinal::ScaleOrdinal;
|
|
pub use point::ScalePoint;
|
|
pub(crate) use sealed::Sealed;
|
|
|
|
pub trait Scale<T> {
|
|
/// Get the tick of the scale.
|
|
fn tick(&self, value: &T) -> Option<f32>;
|
|
|
|
/// Get the least index of the scale.
|
|
fn least_index(&self, _tick: f32) -> usize {
|
|
0
|
|
}
|
|
|
|
/// Get the least index of the scale with the domain.
|
|
fn least_index_with_domain(&self, _tick: f32, _domain: &[T]) -> (usize, f32) {
|
|
(0, 0.)
|
|
}
|
|
}
|