/// labels, group labels appear to the left of the categories.
///
/// ```text
- /// +---------+----------+
- /// | | columns |
- /// +----+----+----+----+ +------+--+----------+
- /// | | nested | | |a1|...data...|
- /// | +----+----+----+ |nested|a2|...data...|
- /// | | a1 | a2 | a3 | | |a3|...data...|
- /// +----+----+----+----+ +------+--+----------+
- /// | |data|data|data|
- /// | | . | . | . |
- /// |rows| . | . | . |
- /// | | . | . | . |
- /// +----+----+----+----+
+ /// ┌────┬──────────────┐ ┌─────────┬──────────┐
+ /// │ │ nested │ │ │ columns │
+ /// │ ├────┬────┬────┤ ├──────┬──┼──────────┤
+ /// │ │ a1 │ a2 │ a3 │ │ │a1│...data...│
+ /// ├────┼────┼────┼────┤ │nested│a2│...data...│
+ /// │ │data│data│data│ │ │a3│...data...│
+ /// │ │ . │ . │ . │ └──────┴──┴──────────┘
+ /// │rows│ . │ . │ . │
+ /// │ │ . │ . │ . │
+ /// └────┴────┴────┴────┘
/// ```
#[serde(rename = "nested")]
Nested,
/// In the corner (row labels only).
///
/// ```text
- /// +------+----------+
- /// |corner| columns |
- /// +------+----------+
- /// | a1|...data...|
- /// | a2|...data...|
- /// | a3|...data...|
- /// +------+----------+
+ /// ┌──────┬──────────┐
+ /// │corner│ columns │
+ /// ├──────┼──────────┤
+ /// │ a1│...data...│
+ /// │ a2│...data...│
+ /// │ a3│...data...│
+ /// └──────┴──────────┘
/// ```
#[default]
#[serde(rename = "inCorner")]
/// The heading region of a rendered pivot table:
///
/// ```text
-/// +------------------+-------------------------------------------------+
-/// | | column headings |
-/// | +-------------------------------------------------+
-/// | corner | |
-/// | and | |
-/// | row headings | data |
-/// | | |
-/// | | |
-/// +------------------+-------------------------------------------------+
+/// ┌──────────────────┬─────────────────────────────────────────────────┐
+/// │ │ column headings │
+/// │ ├─────────────────────────────────────────────────┤
+/// │ corner │ │
+/// │ and │ │
+/// │ row headings │ data │
+/// │ │ │
+/// │ │ │
+/// └──────────────────┴─────────────────────────────────────────────────┘
/// ```
#[derive(Copy, Clone, Debug, PartialEq, Eq, Enum)]
pub enum HeadingRegion {
// than the far left and far right ones. Only the ones that
// start in the last row of the heading are drawn with the
// "category" style, the rest with the "dimension" style,
- // e.g. only the # below are category style:
+ // e.g. only the `║` below are category style:
//
// ```text
- // +-----------------------------------------------------+
- // | bbbb |
- // +-----------------+-----------------+-----------------+
- // | bbbb1 | bbbb2 | bbbb3 |
- // +-----------------+-----------------+-----------------+
- // | aaaa | aaaa | aaaa |
- // +-----+-----+-----+-----+-----+-----+-----+-----+-----+
- // |aaaa1#aaaa2#aaaa3|aaaa1#aaaa2#aaaa3|aaaa1#aaaa2#aaaa3|
- // +-----+-----+-----+-----+-----+-----+-----+-----+-----+
- // ```
+ // ┌─────────────────────────────────────────────────────┐
+ // │ bbbb │
+ // ├─────────────────┬─────────────────┬─────────────────┤
+ // │ bbbb1 │ bbbb2 │ bbbb3 │
+ // ├─────────────────┼─────────────────┼─────────────────┤
+ // │ aaaa │ aaaa │ aaaa │
+ // ├─────╥─────╥─────┼─────╥─────╥─────┼─────╥─────╥─────┤
+ // │aaaa1║aaaa2║aaaa3│aaaa1║aaaa2║aaaa3│aaaa1║aaaa2║aaaa3│
+ // └─────╨─────╨─────┴─────╨─────╨─────┴─────╨─────╨─────┘
+ //```
let row_col = RowColBorder(region, v);
let border = if row == self.height - 1 && inner {
Border::Category(row_col)
}
}
- // Draws the horizontal lines within a dimension, that is,
- // those that separate a category (or group) from its parent
- // group or dimension's label. Our running example doesn't
- // have groups but the `====` lines below show the
- // separators between categories and their dimension label:
+ // Draws the horizontal lines within a dimension, that is, those
+ // that separate a category (or group) from its parent group or
+ // dimension's label. Our running example doesn't have groups
+ // but the `═════` lines below show the separators between
+ // categories and their dimension label:
//
// ```text
- // +-----------------------------------------------------+
- // | bbbb |
- // +=================+=================+=================+
- // | bbbb1 | bbbb2 | bbbb3 |
- // +-----------------+-----------------+-----------------+
- // | aaaa | aaaa | aaaa |
- // +=====+=====+=====+=====+=====+=====+=====+=====+=====+
- // |aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|
- // +-----+-----+-----+-----+-----+-----+-----+-----+-----+
+ // ┌─────────────────────────────────────────────────────┐
+ // │ bbbb │
+ // ╞═════════════════╤═════════════════╤═════════════════╡
+ // │ bbbb1 │ bbbb2 │ bbbb3 │
+ // ├─────────────────┼─────────────────┼─────────────────┤
+ // │ aaaa │ aaaa │ aaaa │
+ // ╞═════╤═════╤═════╪═════╤═════╤═════╪═════╤═════╤═════╡
+ // │aaaa1│aaaa2│aaaa3│aaaa1│aaaa2│aaaa3│aaaa1│aaaa2│aaaa3│
+ // └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
// ```
if row + 1 < self.height {
table.draw_line(Border::Category(RowColBorder(region, h)), (h, y2), {
// line here:
//
// ```text
- // +-----------------------------------------------------+ __
- // | bbbb | |
- // +-----------------+-----------------+-----------------+ |dim "bbbb"
- // | bbbb1 | bbbb2 | bbbb3 | _|
- // +=================+=================+=================+ __
- // | aaaa | aaaa | aaaa | |
- // +-----+-----+-----+-----+-----+-----+-----+-----+-----+ |dim "aaaa"
- // |aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3| _|
- // +-----+-----+-----+-----+-----+-----+-----+-----+-----+
+ // ┌─────────────────────────────────────────────────────┐ __
+ // │ bbbb │ │
+ // ├─────────────────┬─────────────────┬─────────────────┤ │dim "bbbb"
+ // │ bbbb1 │ bbbb2 │ bbbb3 │ _│
+ // ╞═════════════════╪═════════════════╪═════════════════╡ __
+ // │ aaaa │ aaaa │ aaaa │ │
+ // ├─────┬─────┬─────┼─────┬─────┬─────┼─────┬─────┬─────┤ │dim "aaaa"
+ // │aaaa1│aaaa2│aaaa3│aaaa1│aaaa2│aaaa3│aaaa1│aaaa2│aaaa3│ _│
+ // └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
// ```
table.draw_line(
Border::Dimension(RowColBorder(region, h)),