FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    squarify

    function · ferroui-livecharts · v0.5.0

    fn squarify<T: Clone>(items: &[(f64, T)], rect: ferroui_base::Rect) -> Vec<(T, ferroui_base::Rect)>
    

    Partitions rect into rectangles of areas proportional to the weights (TreemapLayout.Squarify), row by row along the shorter side, keeping each row while its worst aspect ratio does not get worse. Non-positive and non-finite weights are skipped; the result is in descending weight order (a stable sort, so equal weights keep their order).

    The weights are normalised by the largest before they are summed, which keeps the areas of the source without its overflow for weights near f64::MAX; a rectangle that collapses to no shorter side places the rest of the items at zero size instead of dividing by zero.

    View source

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.