Skip to content

struct

Plot

pub struct Plot {
    pub width: f32,
    pub height: f32,
    pub marks: Vec<Mark>,
    pub hits: Vec<Hit>,
    pub legend: Vec<LegendItem>,
    pub selectable: bool,
    pub responsive: bool,
    pub zoomable: bool,
    pub focusable: bool,
    pub root_class: String,
    pub plot_class: String,
    pub legend_class: String,
    pub notes: Vec<String>,
}

One chart's drawing.

Fields

width

pub width: f32

Width in drawing units.

height

pub height: f32

Height in drawing units.

marks

pub marks: Vec<Mark>

What's drawn, back to front.

hits

pub hits: Vec<Hit>

The areas that answer to each datum.

legend

pub legend: Vec<LegendItem>

The legend's entries.

selectable

pub selectable: bool

Hits are buttons that fire select, not just described points.

responsive

pub responsive: bool

Laid out for the width it's given, rather than scaled to fit.

zoomable

pub zoomable: bool

Offers zoom buttons (maps).

focusable

pub focusable: bool

Whether to make hits keyboard stops (not for hundreds of points).

root_class

pub root_class: String

Classes for the chart's root and for its drawing.

plot_class

pub plot_class: String

Classes for the drawing.

legend_class

pub legend_class: String

Classes for the legend.

notes

pub notes: Vec<String>

Caveats about this drawing, for the footnote.

Methods

moved

pub fn moved(&mut self, dx: f32, dy: f32)

Everything moved, marks and hits both.

new

pub fn new(width: f32, height: f32) -> Plot

An empty plot width by height pixels.

is_dense

pub fn is_dense(&self, limit: usize) -> bool

Whether it has more than limit marks and hit targets, so it draws on a canvas rather than in SVG.

Trait implementations