Histogram

Struct Histogram 

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

The histogram widget.

A histogram represents the sole display dimension as a Binnable type. The dataset’s values are collected based off how they bin across the range defined by 1st dimension. The number of bins is configured at initialization.

use flat::*;

let schema = Schemas::one("Things");
let dataset = DatasetBuilder::new(schema)
    .add((0,))
    .add((0,))
    .add((1,))
    .build();
let view = dataset.count();
let flat = Histogram::new(&view, 2)
    .render(Render::default());
assert_eq!(
    format!("\n{}", flat.to_string()),
    r#"
Things  |Sum(Count)
[0, 1)  |**
[1, 2]  |*"#);

Implementations§

Source§

impl<'a, S, V> Histogram<'a, S, V>
where S: Schema, V: View<S>, <V as View<S>>::PrimaryDimension: Clone + Display + PartialEq + PartialOrd + Add<<V as View<S>>::PrimaryDimension, Output = <V as View<S>>::PrimaryDimension> + Sub<<V as View<S>>::PrimaryDimension, Output = <V as View<S>>::PrimaryDimension> + Binnable, <V as View<S>>::BreakdownDimension: Clone + Display + PartialEq + Eq + Hash + Ord,

Source

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

Construct a histogram widget from the provided view and number of bins.

Source

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

Generate the flat rendering for this histogram.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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