pub struct Bar {
pub name: String,
pub orientation: Orientation,
pub argument: f64,
pub value: f64,
pub base_offset: Option<f64>,
pub bar_width: f64,
pub stroke: Stroke,
pub fill: Color32,
}
Expand description
One bar in a BarChart
. Potentially floating, allowing stacked bar charts.
Width can be changed to allow variable-width histograms.
Fields
name: String
Name of plot element in the diagram (annotated by default formatter)
orientation: Orientation
Which direction the bar faces in the diagram
argument: f64
Position on the argument (input) axis – X if vertical, Y if horizontal
value: f64
Position on the value (output) axis – Y if vertical, X if horizontal
base_offset: Option<f64>
For stacked bars, this denotes where the bar starts. None if base axis
bar_width: f64
Thickness of the bar
stroke: Stroke
Line width and color
fill: Color32
Fill color
Implementations
sourceimpl Bar
impl Bar
sourcepub fn new(argument: f64, height: f64) -> Bar
pub fn new(argument: f64, height: f64) -> Bar
Create a bar. Its orientation
is set by its BarChart
parent.
argument
: Position on the argument axis (X if vertical, Y if horizontal).value
: Height of the bar (if vertical).
By default the bar is vertical and its base is at zero.
sourcepub fn base_offset(self, offset: f64) -> Bar
pub fn base_offset(self, offset: f64) -> Bar
Offset the base of the bar. This offset is on the Y axis for a vertical bar and on the X axis for a horizontal bar.
sourcepub fn horizontal(self) -> Bar
pub fn horizontal(self) -> Bar
Set orientation of the element as horizontal. Argument axis is Y.