DagChartConfig

Struct DagChartConfig 

Source
pub struct DagChartConfig {
    pub abbreviate: bool,
    pub show_aggregate: bool,
}
Expand description

Render configuration specific to DagCharts.

§Example

let dagchart_config = DagChartConfig {
    abbreviate: true,
    show_aggregate: true,
    ..DagChartConfig::default()
};

Fields§

§abbreviate: bool

Whether to abbreviate the dimensional values in the rendering or not. Use this option when the dimensions have long std::fmt::Display forms. Abbreviation is attempted irrespective of the width_hint.

Notice, abbreviation is performed on values only, and not on the column headers. Moreover, the abbreviation is bounded by the column header width. If you want shorter abbreviations, be sure to shorten the headers as well!

Default: false.

§show_aggregate: bool

Whether to show the aggregated result for the non-primary dimension(s) of the dataset. Notice, this is different from show_aggregate in the root Render configuration (which shows the primary dimension).

The aggregate always represents the matched columns from the primary towards the non-primary. Consequently, the result at each level shows the aggregate across the previous level - that is, the aggregates “cascade”.

For example, consider the following Dataset.

r#"
A (primary) | B  | C  | value
a1          | b1 | c1 | 1
a1          | b2 | c1 | 2
a1          | b2 | c2 | 3"#

Then, the aggregate computation for each level is as follows:

r#"
Dimensional Combinations | Show Aggregate
(a1,)                    | aggregate([1, 2, 3])
(a1, b1)                 | aggregate([1])
(a1, b2)                 | aggregate([2, 3])
(a1, b1, c1)             | aggregate([1])
(a1, b2, c1)             | aggregate([2])
(a1, b2, c2)             | aggregate([3])"#

In flat, the above dataset as Aggregate::Sum will render as follows:

// Output (modified for alignment)
// Observe the cascade (ex: `b2 [5] = c1 [2] + c2 [3]`).
r#"
C  Sum   B  Sum   A  Sum
c1 [1] - b1 [1] ┐
c1 [2] - b2 [5] - a1 [6]
c2 [3] ┘        ┘"#

Default: false.

Trait Implementations§

Source§

impl Debug for DagChartConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DagChartConfig

Source§

fn default() -> DagChartConfig

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.