class RatatuiRuby::Widgets::Dataset
Defines a Dataset for a Chart.
- name
-
The name of the dataset.
- data
-
Array of arrays [[x, y], [x, y]] (Floats).
- style
-
The style of the line.
- marker
-
Symbol (
:dot,:braille,:block,:bar,:half_block) graph_type-
Symbol (
:line,:scatter)
Attributes
list of [x, y] coordinates.
Type of graph (:line, :scatter).
Marker type (:dot, :braille, :block, :bar, :half_block).
:half_block uses ▀ and ▄ characters for higher resolution than :dot.
Name for logical identification or legend.
Style applied to the dataset (Style).
Note: Due to Ratatui’s Chart widget design, only the foreground color (fg) is applied to markers in the chart area. The full style (including bg and modifiers) is displayed in the legend.
Supports:
-
fg: Foreground color of markers (Symbol/Hex) - _applied to chart_ -
bg: Background color (Symbol/Hex) - _legend only_ -
modifiers: Array of effects (:bold,:dim,:italic,:underlined,:slow_blink,:rapid_blink,:reversed,:hidden,:crossed_out) - _legend only_
Public Class Methods
Source
# File lib/ratatui_ruby/widgets/chart.rb, line 103 def initialize(name:, data:, style: nil, marker: :dot, graph_type: :line) coerced_data = data.map { |point| [Float(point[0]), Float(point[1])] } super(name:, data: coerced_data, style:, marker:, graph_type:) end
Creates a new Dataset.
- name
-
String.
- data
-
Array of [x, y] (Numeric, duck-typed via
to_f). - style
- marker
-
Symbol.
graph_type-
Symbol.