Skip to content

Commit

Permalink
docs(canvas): add support note for Braille marker (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshka authored Sep 10, 2023
1 parent ebd3680 commit 17797d8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
15 changes: 11 additions & 4 deletions src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,21 @@ pub mod braille {
/// Marker to use when plotting data points
#[derive(Debug, Default, Display, EnumString, Clone, Copy, Eq, PartialEq, Hash)]
pub enum Marker {
/// One point per cell in shape of dot
/// One point per cell in shape of dot ("•")
#[default]
Dot,
/// One point per cell in shape of a block
/// One point per cell in shape of a block ("█")
Block,
/// One point per cell in the shape of a bar
/// One point per cell in the shape of a bar ("▄")
Bar,
/// Up to 8 points per cell
/// Use the [Unicode Braille Patterns](https://en.wikipedia.org/wiki/Braille_Patterns) block to
/// represent data points.
///
/// This is a 2x4 grid of dots, where each dot can be either on or off.
///
/// Note: Support for this marker is limited to terminals and fonts that support Unicode
/// Braille Patterns. If your terminal does not support this, you will see unicode replacement
/// characters (�) instead of Braille dots.
Braille,
}

Expand Down
14 changes: 12 additions & 2 deletions src/widgets/canvas/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,16 @@ impl<'a> Context<'a> {
}
}

/// The Canvas widget may be used to draw more detailed figures using braille patterns (each
/// cell can have a braille character in 8 different positions).
/// The Canvas widget provides a means to draw shapes (Lines, Rectangles, Circles, etc.) on a grid.
///
/// By default the grid is made of Braille patterns but you may change the marker to use a different
/// set of symbols. If your terminal or font does not support this unicode block, you will see
/// unicode replacement characters (�) instead of braille dots. The Braille patterns provide a more
/// fine grained result (2x4 dots) but you might want to use a simple dot, block, or bar instead by
/// calling the [`marker`] method if your target environment does not support those symbols,
///
/// See [Unicode Braille Patterns](https://en.wikipedia.org/wiki/Braille_Patterns) for more info.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -355,6 +363,8 @@ impl<'a> Context<'a> {
/// });
/// });
/// ```
///
/// [`marker`]: #method.marker
#[derive(Debug, Clone, PartialEq)]
pub struct Canvas<'a, F>
where
Expand Down

0 comments on commit 17797d8

Please sign in to comment.