pub struct ZeroLine {
pub color: AnsiColor,
pub character: char,
}Expand description
A horizontal reference line drawn at Y = 0.0 across the data area.
The zero line is only rendered when the data range straddles zero — if all values are positive or all negative, this option has no effect. It is rendered before the data series so that series arc characters always appear on top.
§Example
use asciigraph::{plot, Config, ZeroLine, AnsiColor};
let data = vec![-3.0, -1.0, 0.0, 1.0, 3.0];
let graph = plot(&data, Config::default().zero_line(ZeroLine::new()));Fields§
§color: AnsiColorThe ANSI color used to render the zero line.
Defaults to AnsiColor::DEFAULT (no color).
character: charThe character used to draw the zero line.
Defaults to ─ (DEFAULT_CHAR_SET.horizontal).
Implementations§
Source§impl ZeroLine
impl ZeroLine
Sourcepub fn with_color(color: AnsiColor) -> Self
pub fn with_color(color: AnsiColor) -> Self
Creates a zero line rendered in a specific ANSI color. Uses the default horizontal character.
Sourcepub fn with_char_and_color(character: char, color: AnsiColor) -> Self
pub fn with_char_and_color(character: char, color: AnsiColor) -> Self
Creates a zero line with both a custom character and a custom ANSI color.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ZeroLine
impl RefUnwindSafe for ZeroLine
impl Send for ZeroLine
impl Sync for ZeroLine
impl Unpin for ZeroLine
impl UnsafeUnpin for ZeroLine
impl UnwindSafe for ZeroLine
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