Class: RatatuiRuby::Widgets::Dataset
- Inherits:
-
Object
- Object
- RatatuiRuby::Widgets::Dataset
- Includes:
- CoerceableWidget
- Defined in:
- lib/ratatui_ruby/widgets/chart.rb
Overview
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)
Instance Method Summary collapse
-
#initialize(name:, data:, style: nil, marker: :dot, graph_type: :line) ⇒ Dataset
constructor
Creates a new Dataset.
Methods included from CoerceableWidget
Constructor Details
#initialize(name:, data:, style: nil, marker: :dot, graph_type: :line) ⇒ Dataset
Creates a new Dataset.
- name
-
String.
- data
-
Array of [x, y] (Numeric, duck-typed via
to_f). - style
-
Style.
- marker
-
Symbol.
- graph_type
-
Symbol.
103 104 105 106 |
# 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 |