docs(canvas): add support note for Braille marker (#472)

This commit is contained in:
Josh McKinney 2023-09-09 17:08:28 -07:00 committed by GitHub
parent ebd3680a47
commit 17797d83da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View file

@ -244,14 +244,21 @@ pub mod braille {
/// Marker to use when plotting data points /// Marker to use when plotting data points
#[derive(Debug, Default, Display, EnumString, Clone, Copy, Eq, PartialEq, Hash)] #[derive(Debug, Default, Display, EnumString, Clone, Copy, Eq, PartialEq, Hash)]
pub enum Marker { pub enum Marker {
/// One point per cell in shape of dot /// One point per cell in shape of dot ("•")
#[default] #[default]
Dot, Dot,
/// One point per cell in shape of a block /// One point per cell in shape of a block ("█")
Block, Block,
/// One point per cell in the shape of a bar /// One point per cell in the shape of a bar ("▄")
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 (<28>) instead of Braille dots.
Braille, Braille,
} }

View file

@ -320,8 +320,16 @@ impl<'a> Context<'a> {
} }
} }
/// The Canvas widget may be used to draw more detailed figures using braille patterns (each /// The Canvas widget provides a means to draw shapes (Lines, Rectangles, Circles, etc.) on a grid.
/// cell can have a braille character in 8 different positions). ///
/// 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 (<28>) 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 /// # Examples
/// ///
/// ``` /// ```
@ -355,6 +363,8 @@ impl<'a> Context<'a> {
/// }); /// });
/// }); /// });
/// ``` /// ```
///
/// [`marker`]: #method.marker
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct Canvas<'a, F> pub struct Canvas<'a, F>
where where