#plot #graph #chart #text

flat

Project multi-dimensional data onto the flat textual plane

10 releases

new 0.1.6 Oct 19, 2024
0.1.5 Aug 19, 2024
0.1.4 Jul 13, 2024
0.0.3 Jul 4, 2024

#72 in Visualization

Download history 470/week @ 2024-07-01 287/week @ 2024-07-08 15/week @ 2024-07-15 4/week @ 2024-07-22 149/week @ 2024-08-19 10/week @ 2024-09-16 23/week @ 2024-09-23 4/week @ 2024-09-30 1/week @ 2024-10-07 154/week @ 2024-10-14

182 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

~245KB