#plot #graph #chart #text

flat

Project multi-dimensional data onto the flat textual plane

9 releases

0.1.5 Aug 19, 2024
0.1.4 Jul 13, 2024
0.0.3 Jul 4, 2024

#79 in Visualization

Download history 169/week @ 2024-06-27 359/week @ 2024-07-04 239/week @ 2024-07-11 6/week @ 2024-07-18 3/week @ 2024-07-25 129/week @ 2024-08-15 20/week @ 2024-08-22

149 downloads per month

MIT/Apache

280KB
6K SLoC

flat

Project multi-dimensional data onto the flat textual plane.

use flat::*;

let schema = Schemas::three("animal", "length", "stable");
let dataset = Dataset::builder(schema)
    .add(("whale".to_string(), 4u32, true))
    .add(("shark".to_string(), 4u32, false))
    .add(("shark".to_string(), 1u32, false))
    .add(("shark".to_string(), 1u32, true))
    .add(("shark".to_string(), 1u32, true))
    .add(("shark".to_string(), 1u32, true))
    .add(("tiger".to_string(), 4u32, false))
    .add(("tiger".to_string(), 4u32, false))
    .add(("tiger".to_string(), 5u32, true))
    .add(("tiger".to_string(), 5u32, true))
    .add(("tiger".to_string(), 5u32, true))
    .add(("tiger".to_string(), 5u32, true))
    .add(("tiger".to_string(), 5u32, true))
    .add(("tiger".to_string(), 5u32, true))
    .add(("tiger".to_string(), 1u32, false))
    .add(("tiger".to_string(), 1u32, false))
    .add(("tiger".to_string(), 1u32, false))
    .build();
let view = dataset.breakdown_3rd();
let flat = BarChart::new(&view).render(Render::default());
assert_eq!(
    format!("\n{}", flat.to_string()),
    r#"
                   Sum(Breakdown(stable))
length    animal  |false   true |
1       - shark   |  **    ***  |
4       ┘
1       ┐
4       - tiger   |*****  ******|
5       ┘
4       - whale   |         *   |"#
);

Dependencies

~240KB