pub struct GeomBullet {
pub target: Option<String>,
pub ranges: Vec<f64>,
pub range_columns: Vec<String>,
pub band_colors: Vec<(u8, u8, u8)>,
pub bar_color: (u8, u8, u8),
pub target_color: (u8, u8, u8),
pub band_width: f64,
pub bar_width: f64,
pub target_width: f64,
}Expand description
Bullet chart. Map x (KPI) and y (actual value); name the target
column in target and give the range bands either as shared
breakpoints (ranges) or per-row columns (range_columns).
Fields§
§target: Option<String>Column holding each row’s target (None draws no target tick).
ranges: Vec<f64>Shared band upper limits, ascending (used when range_columns is
empty).
range_columns: Vec<String>Columns holding each row’s band upper limits, ascending.
band_colors: Vec<(u8, u8, u8)>Band colours from the first (poorest) band outward; recycled.
bar_color: (u8, u8, u8)§target_color: (u8, u8, u8)§band_width: f64Band, bar and target-tick widths as fractions of the category slot.
bar_width: f64§target_width: f64Implementations§
Source§impl GeomBullet
impl GeomBullet
Sourcepub fn with_target(self, target_column: impl Into<String>) -> Self
pub fn with_target(self, target_column: impl Into<String>) -> Self
Bullet chart with targets from target_column.
Sourcepub fn with_ranges(self, ranges: impl IntoIterator<Item = f64>) -> Self
pub fn with_ranges(self, ranges: impl IntoIterator<Item = f64>) -> Self
Shared band limits (ascending), e.g. [50.0, 75.0, 100.0].
Sourcepub fn with_range_columns<S: Into<String>>(
self,
cols: impl IntoIterator<Item = S>,
) -> Self
pub fn with_range_columns<S: Into<String>>( self, cols: impl IntoIterator<Item = S>, ) -> Self
Per-row band limits from these columns (ascending).
Trait Implementations§
Source§impl Default for GeomBullet
impl Default for GeomBullet
Source§impl Geom for GeomBullet
impl Geom for GeomBullet
Source§fn setup_data(&self, data: &mut DataFrame, _warnings: &mut Vec<String>)
fn setup_data(&self, data: &mut DataFrame, _warnings: &mut Vec<String>)
The y scale must hold the bands and targets, not just the actuals.
Source§fn draw(
&self,
data: &DataFrame,
coord: &dyn Coord,
scales: &ScaleSet,
_theme: &Theme,
backend: &mut dyn DrawBackend,
) -> Result<(), RenderError>
fn draw( &self, data: &DataFrame, coord: &dyn Coord, scales: &ScaleSet, _theme: &Theme, backend: &mut dyn DrawBackend, ) -> Result<(), RenderError>
Draw this geometry.
Source§fn required_aes(&self) -> Vec<Aesthetic>
fn required_aes(&self) -> Vec<Aesthetic>
Required aesthetics.
Source§fn default_stat(&self) -> Box<dyn Stat>
fn default_stat(&self) -> Box<dyn Stat>
Default stat for this geom.
Source§fn default_position(&self) -> Box<dyn Position>
fn default_position(&self) -> Box<dyn Position>
Default position adjustment.
Source§fn default_params(&self) -> GeomParams
fn default_params(&self) -> GeomParams
Non-mapped visual defaults.
Source§fn include_zero_baseline(&self) -> bool
fn include_zero_baseline(&self) -> bool
Whether this geom draws from a 0 baseline, so the Y scale should include
0 even when
y is explicitly mapped (bars/columns/area/histograms — as
in ggplot2). Default false.Source§fn consumes_tooltips(&self) -> bool
fn consumes_tooltips(&self) -> bool
Whether this geom calls [
set_row_extras] (so it reads
Aes::tooltip and
Aes::data_attr, and a
GGPlot::tooltip template on it has
a visible effect). Default false; the build pipeline warns when a
tooltip() template is set on a layer whose geom returns false
here (review PR#141 finding 6, LOW: a template silently did nothing
on e.g. geom_area/geom_boxplot/geom_ribbon). Point, segment,
curve, path, line, hex, polygon, sf, rect/tile and col/bar/
histogram return true.Source§fn set_series_color(&mut self, color: (u8, u8, u8))
fn set_series_color(&mut self, color: (u8, u8, u8))
Apply a brand/primary color to this geom’s single-series default (its
color or fill). The build pipeline calls this only when the layer has
no color/fill aesthetic mapped, so an explicit mapping always wins. The
default is a no-op; series geoms override it.Source§fn figure_band_height(&self, _width: f64, _theme: &Theme) -> Option<f64>
fn figure_band_height(&self, _width: f64, _theme: &Theme) -> Option<f64>
A figure-level layer on a faceted plot: the height of the band it
needs under the whole panel grid at
width, when it draws once
there instead of in every panel (e.g. GeomAttribution::figure).
Default None (drawn per panel).Source§fn apply_element_geom(&mut self, _el: &ElementGeom)
fn apply_element_geom(&mut self, _el: &ElementGeom)
Recolour this geom’s built-in default colour/fill from the theme’s
ink/paper/accent palette (B2-7’s
element_geom), called once per
layer before set_series_color — and only
when the layer was not configured explicitly (geom_*_with(...);
the build pipeline gates the call on the same explicit_style flag
set_series_color’s brand-colour application is gated on). That
gate, not a field-value comparison, is what keeps an explicit colour
untouched: a geom that honours this replaces a field still at its
own hard-coded default (black/(50, 50, 50) → ink, white →
paper) by comparing its value, which cannot by itself tell an
explicitly-set colour that happens to equal that default (e.g.
GeomPoint { color: (0, 0, 0), .. } under geom_point_with) apart
from one that was simply never touched — only skipping the call
entirely for an explicitly-configured layer closes that gap (review
PR#141 finding 4). Default no-op; None fields of ElementGeom
change nothing, so the default theme (no ink/paper/accent set)
stays byte-identical.Source§fn allows_infinite(&self) -> bool
fn allows_infinite(&self) -> bool
Whether
-Inf/Inf position values are meaningful for this geom
(ggplot2: “extend to the panel edge”). Rows with infinite positions are
otherwise dropped with a warning before stats run. NaN is always
dropped — unless Geom::keeps_na_as_break says otherwise. Default
false; geom_rect returns true.Source§fn keeps_na_as_break(&self) -> bool
fn keeps_na_as_break(&self) -> bool
Whether a row with a non-finite position is a break rather than a
removal (ggplot2’s
GeomPath/GeomLine NA handling): the row still
counts toward the “removed N rows” warning, but it is not deleted
from the built DataFrame, so the geom’s own per-group point list
still contains it — as a non-finite pixel position after the scale
and coordinate transform, which crate::render::backend::DrawBackend::draw_line
splits on into separate polylines (ggplot2’s NA-break semantics)
instead of silently joining the finite points across the gap.
Default false (the row is dropped, as for every other geom);
line/path/step return true.Source§fn inherit_aes(&self) -> bool
fn inherit_aes(&self) -> bool
Whether the layer inherits the plot-level aesthetic mapping (ggplot2’s
inherit.aes). Reference-line geoms return false, as in ggplot2, so a
plot-level color/x/y mapping does not leak into a geom_hline.
Default true.Source§fn mapped_only_columns(&self) -> &'static [&'static str]
fn mapped_only_columns(&self) -> &'static [&'static str]
Canonical column names this geom only reads when the user actually
mapped the corresponding aesthetic (D3, B3-5) — never from a raw
column that merely happens to share the name (e.g. a SQL alias
literally called
lower). build_layer drops any of these columns
right after resolve_mappings unless the aesthetic was mapped.
Default empty; GeomBoxplot returns ["lower", "middle", "upper", "outliers"].Source§fn validate_layer(
&self,
_pre_stat_columns: &[String],
_stat_name: &str,
) -> Result<(), String>
fn validate_layer( &self, _pre_stat_columns: &[String], _stat_name: &str, ) -> Result<(), String>
Stat-dependent layer validation beyond
required_aes
(B3-5): called once per layer with the resolved (pre-stat, post-D3-drop)
column names and the layer’s stat name, before the stat runs. Default
no-op. GeomBoxplot requires lower/middle/upper to be mapped
under stat="identity", else y.Auto Trait Implementations§
impl Freeze for GeomBullet
impl RefUnwindSafe for GeomBullet
impl Send for GeomBullet
impl Sync for GeomBullet
impl Unpin for GeomBullet
impl UnsafeUnpin for GeomBullet
impl UnwindSafe for GeomBullet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more