pub struct GroupBy<T>(_, _)
where
    T: DiscreteRanged
;
Expand description

Grouping the value in the coordinate specification.

This combinator doesn’t change the coordinate mapping behavior. But it changes how the key point is generated, this coordinate specification will enforce that only the first value in each group can be emitted as the bold key points.

This is useful, for example, when we have an X axis is a integer and denotes days. And we are expecting the tick mark denotes weeks, in this way we can make the range spec grouping by 7 elements. With the help of the GroupBy decorator, this can be archived quite easily:

use plotters::prelude::*;
let mut buf = vec![0;1024*768*3];
let area = BitMapBackend::with_buffer(buf.as_mut(), (1024, 768)).into_drawing_area();
let chart = ChartBuilder::on(&area)
    .build_cartesian_2d((0..100).group_by(7), 0..100)
    .unwrap();

To apply this combinator, call ToGroupByRange::group_by method on any discrete coordinate spec.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Get the number of element in the range Note: we assume that all the ranged discrete coordinate has finite value Read more

Map a value to the index Read more

Reverse map the index to the value Read more

Return a iterator that iterates over the all possible values Read more

Returns the previous value in this range Read more

Returns the next value in this range Read more

This marker decides if Plotters default ValueFormatter implementation should be used. This assicated type can be one of follow two types: Read more

The type of this value in this range specification

This function maps the value to i32, which is the drawing coordinate

Get the range of this value

This function gives the key points that we can draw a grid based on this

This function provides the on-axis part of its range

Format the value

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Bind a existing coordinate spec with a given key points algorithm. See WithKeyPointMethod for more details. Example: Read more

Bind a existing coordinate spec with a given key points vector. See WithKeyPoints for more details. Example: Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Set the step value, make a linspace coordinate from the given range. By default the matching method use the exact match Read more

Make the partial axis Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.