DagChart

Struct DagChart 

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

The dag-chart widget.

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

See also: PathChart

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 = DagChart::new(&view)
    .render(Render::default());
assert_eq!(
    format!("\n{}", flat.to_string()),
    r#"
Size      Animal  |Sum(Count)
medium  - shark   |**
small   ┘
medium  - tiger   |***
small   ┘
large   - whale   |*"#);

Implementations§

Source§

impl<'a, S, V> DagChart<'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, <V as View<S>>::DisplayDimensions: Clone + PartialEq + Eq + Hash + Ord,

Source

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

Construct a dag-chart widget from the provided view.

Source

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

Generate the flat rendering for this dag-chart.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<'a, S, V> UnwindSafe for DagChart<'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.