PieChartBuilder

Struct PieChartBuilder 

Source
pub struct PieChartBuilder<C: PixelColor> { /* private fields */ }
Expand description

Builder for pie charts

Implementations§

Source§

impl<C> PieChartBuilder<C>
where C: From<Rgb565> + PixelColor,

Source

pub fn new() -> Self

Create a new pie chart builder

Source

pub fn center(self, center: Point) -> Self

Set the center point

Source

pub fn radius(self, radius: u32) -> Self

Set the radius

Source

pub fn colors(self, colors: &[C]) -> Self

Set slice colors

Source

pub fn start_angle(self, angle: f32) -> Self

Set the starting angle

Source

pub fn donut(self, inner_radius: u32) -> Self

Make this a donut chart with the specified inner radius

Source

pub fn donut_percentage(self, percentage: u32) -> Self

Make this a donut chart with inner radius as percentage of outer radius

§Arguments
  • percentage - Inner radius as percentage (0-100) of the outer radius
§Examples
// Create a balanced donut chart (40% inner radius)
let chart = PieChart::builder()
    .radius(100)
    .donut_percentage(40) // Inner radius will be 40 pixels
    .colors(&[Rgb565::BLUE, Rgb565::RED])
    .build()?;
Source

pub fn balanced_donut(self) -> Self

Make this a balanced donut chart with 50% inner radius

This is a convenience method for creating visually balanced donut charts that work well across different display sizes.

§Examples
let chart = PieChart::builder()
    .radius(80)
    .balanced_donut() // Inner radius will be 40 pixels (50%)
    .colors(&[Rgb565::BLUE, Rgb565::RED])
    .build()?;
Source

pub fn thin_donut(self) -> Self

Make this a thin donut chart with 25% inner radius

Thin donuts emphasize the data segments while still providing some center space. Good for detailed data analysis.

Source

pub fn thick_donut(self) -> Self

Make this a thick donut chart with 75% inner radius

Thick donuts maximize center space for displaying additional information like totals or status indicators.

Source

pub fn with_border(self, border: BorderStyle<C>) -> Self

Add a border to slices

Source

pub fn labels(self, labels: LabelStyle) -> Self

Configure labels

Source

pub fn with_title(self, title: &str) -> Self

Set the chart title

Source

pub fn background_color(self, color: C) -> Self

Set the background color

Trait Implementations§

Source§

impl<C> ChartBuilder<C> for PieChartBuilder<C>
where C: From<Rgb565> + PixelColor,

Source§

type Chart = PieChart<C>

The chart type this builder creates
Source§

type Error = ChartError

Error type for building operations
Source§

fn build(self) -> Result<Self::Chart, Self::Error>

Build the chart with current configuration
Source§

impl<C: Debug + PixelColor> Debug for PieChartBuilder<C>

Source§

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

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

impl<C> Default for PieChartBuilder<C>
where C: From<Rgb565> + PixelColor,

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<C> Freeze for PieChartBuilder<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for PieChartBuilder<C>
where C: RefUnwindSafe,

§

impl<C> Send for PieChartBuilder<C>
where C: Send,

§

impl<C> Sync for PieChartBuilder<C>
where C: Sync,

§

impl<C> Unpin for PieChartBuilder<C>
where C: Unpin,

§

impl<C> UnwindSafe for PieChartBuilder<C>
where C: UnwindSafe,

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.