PathChart

Struct PathChart 

Source
pub struct PathChart<'a, S, V>
where S: Schema, V: View<S>,
{ /* private fields */ }
Expand description

The path-chart widget.

A path-chart represents each unique tuple of the view’s display dimensions as a path in a directory listing. Paths with common sub-paths, starting from the primary dimension (1st), are collapsed in the frame.

See also: DagChart

use flat::*;

let schema = Schemas::two("Animal", "Size");
let dataset = DatasetBuilder::new(schema)
    .add(("whale".to_string(), "large".to_string()))
    .add(("shark".to_string(), "medium".to_string()))
    .add(("shark".to_string(), "small".to_string()))
    .add(("tiger".to_string(), "medium".to_string()))
    .add(("tiger".to_string(), "medium".to_string()))
    .add(("tiger".to_string(), "small".to_string()))
    .build();
let view = dataset.count();
let flat = PathChart::new(&view)
    .render(Render::default());
assert_eq!(
    format!("\n{}", flat.to_string()),
    r#"
/Animal /Size  |Sum(Count)
/shark         |**
  /medium
  /small
/tiger         |***
  /medium
  /small
/whale         |*
  /large"#);

Implementations§

Source§

impl<'a, S, V> PathChart<'a, S, V>
where S: Schema, V: View<S>, <V as View<S>>::PrimaryDimension: Clone + PartialEq + Eq + Hash, <V as View<S>>::BreakdownDimension: Clone + Display + PartialEq + Eq + Hash + Ord,

Source

pub fn new(view: &'a V) -> Self

Construct a path-chart widget from the provided view.

Source

pub fn render(self, config: Render<PathChartConfig>) -> Flat

Generate the flat rendering for this path-chart.

Auto Trait Implementations§

§

impl<'a, S, V> Freeze for PathChart<'a, S, V>

§

impl<'a, S, V> RefUnwindSafe for PathChart<'a, S, V>

§

impl<'a, S, V> Send for PathChart<'a, S, V>
where V: Sync, S: Send,

§

impl<'a, S, V> Sync for PathChart<'a, S, V>
where V: Sync, S: Sync,

§

impl<'a, S, V> Unpin for PathChart<'a, S, V>
where S: Unpin,

§

impl<'a, S, V> UnwindSafe for PathChart<'a, S, V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.