Skip to main content

Points

Trait Points 

Source
pub trait Points {
    // Required methods
    fn len(&self) -> usize;
    fn x(&self, index: usize) -> f64;
    fn y(&self, index: usize) -> f64;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A series of points, in ascending x (a chart finds the visible ones by binary search): a line, or the bars of a bar series. A y that is not finite is a gap.

Points out of order do not break anything, but they draw wrong and cost more: each step back restarts the line, and the step forward after it is drawn across every column it spans.

Required Methods§

Source

fn len(&self) -> usize

How many points there are.

Source

fn x(&self, index: usize) -> f64

The x of point index: never below the one before, never NaN.

Source

fn y(&self, index: usize) -> f64

The y of point index.

Provided Methods§

Source

fn is_empty(&self) -> bool

Whether there are none.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Points for (&[f64], &[f64])

x values and y values side by side; as long as the shorter.

Source§

fn len(&self) -> usize

Source§

fn x(&self, index: usize) -> f64

Source§

fn y(&self, index: usize) -> f64

Source§

impl Points for [(f64, f64)]

Source§

fn len(&self) -> usize

Source§

fn x(&self, index: usize) -> f64

Source§

fn y(&self, index: usize) -> f64

Implementors§