Class: RatatuiRuby::Widgets::Chart

Inherits:
Object
  • Object
show all
Includes:
CoerceableWidget
Defined in:
lib/ratatui_ruby/widgets/chart.rb

Overview

Plots data points on a Cartesian coordinate system.

Trends and patterns are invisible in raw logs. You need to see the shape of the data to understand the story it tells.

This widget plots X/Y coordinates. It supports multiple datasets, custom axes, and different marker types.

Use it for analytics, scientific data, or monitoring metrics over time.

Example

Run the interactive demo from the terminal:

ruby examples/widget_chart/app.rb

Instance Method Summary collapse

Methods included from CoerceableWidget

included

Constructor Details

#initialize(datasets:, x_axis:, y_axis:, block: nil, style: nil, legend_position: nil, hidden_legend_constraints: []) ⇒ Chart

Creates a new Chart widget.

datasets

Array of Datasets.

x_axis

X Axis config.

y_axis

Y Axis config.

block

Wrapper (optional).

style

Base style (optional).

legend_position

Symbol — corners: :top_left, :top_right, :bottom_left, :bottom_right; edges: :top, :bottom, :left, :right.

hidden_legend_constraints

Array of two Constraints [width, height] (optional).



167
168
169
# File 'lib/ratatui_ruby/widgets/chart.rb', line 167

def initialize(datasets:, x_axis:, y_axis:, block: nil, style: nil, legend_position: nil, hidden_legend_constraints: [])
  super
end