Module: RatatuiRuby::Symbols::Bar

Defined in:
lib/ratatui_ruby/symbols.rb

Overview

Vertical bar characters for sparklines and bar charts.

Sparklines and vertical bar charts need characters that show partial fill. Memorizing Unicode lower block characters is tedious and error-prone.

This module exposes both individual characters and predefined sets. Use the sets with Sparkline widget, or use individual characters for custom visualizations.

Examples

– SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++

# Use NINE_LEVELS for high-resolution sparklines (default)
sparkline = tui.sparkline(data: [1, 2, 3], bar_set: Symbols::Bar::NINE_LEVELS)

# Use THREE_LEVELS for simpler rendering
sparkline = tui.sparkline(data: [1, 2, 3], bar_set: Symbols::Bar::THREE_LEVELS)

– SPDX-SnippetEnd ++

Constant Summary collapse

FULL =

Full height bar (8/8).

""
SEVEN_EIGHTHS =

7/8 height bar.

""
THREE_QUARTERS =

3/4 height bar (6/8).

""
FIVE_EIGHTHS =

5/8 height bar.

""
HALF =

Half height bar (4/8).

""
THREE_EIGHTHS =

3/8 height bar.

""
ONE_QUARTER =

1/4 height bar (2/8).

""
ONE_EIGHTH =

1/8 height bar.

""
NINE_LEVELS =

High-resolution bar set with 9 distinct levels.

{
  full: FULL,
  seven_eighths: SEVEN_EIGHTHS,
  three_quarters: THREE_QUARTERS,
  five_eighths: FIVE_EIGHTHS,
  half: HALF,
  three_eighths: THREE_EIGHTHS,
  one_quarter: ONE_QUARTER,
  one_eighth: ONE_EIGHTH,
  empty: " ",
}.freeze
THREE_LEVELS =

Low-resolution bar set with 3 levels (full, half, empty).

{
  full: FULL,
  seven_eighths: FULL, # collapsed to full
  three_quarters: HALF, # collapsed to half
  five_eighths: HALF, # collapsed to half
  half: HALF,
  three_eighths: HALF, # collapsed to half
  one_quarter: HALF, # collapsed to half
  one_eighth: " ", # collapsed to empty
  empty: " ",
}.freeze