ratatui_ruby 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.builds/ruby-3.2.yml +52 -0
  3. data/.builds/ruby-3.3.yml +52 -0
  4. data/.builds/ruby-3.4.yml +52 -0
  5. data/.builds/ruby-4.0.0-preview3.yml +53 -0
  6. data/AGENTS.md +2 -2
  7. data/README.md +33 -13
  8. data/REUSE.toml +5 -0
  9. data/Rakefile +3 -100
  10. data/docs/images/examples-calendar_demo.rb.png +0 -0
  11. data/docs/images/examples-chart_demo.rb.png +0 -0
  12. data/docs/images/examples-list_styles.rb.png +0 -0
  13. data/docs/images/examples-quickstart_lifecycle.rb.png +0 -0
  14. data/docs/images/examples-stock_ticker.rb.png +0 -0
  15. data/docs/quickstart.md +57 -11
  16. data/examples/analytics.rb +2 -1
  17. data/examples/calendar_demo.rb +55 -0
  18. data/examples/chart_demo.rb +84 -0
  19. data/examples/list_styles.rb +66 -0
  20. data/examples/login_form.rb +2 -1
  21. data/examples/quickstart_dsl.rb +30 -0
  22. data/examples/quickstart_lifecycle.rb +40 -0
  23. data/examples/readme_usage.rb +21 -0
  24. data/examples/stock_ticker.rb +13 -5
  25. data/examples/system_monitor.rb +2 -1
  26. data/examples/test_calendar_demo.rb +66 -0
  27. data/examples/test_list_styles.rb +61 -0
  28. data/ext/ratatui_ruby/.cargo/config.toml +5 -0
  29. data/ext/ratatui_ruby/Cargo.lock +94 -1
  30. data/ext/ratatui_ruby/Cargo.toml +3 -2
  31. data/ext/ratatui_ruby/extconf.rb +1 -1
  32. data/ext/ratatui_ruby/src/events.rs +4 -1
  33. data/ext/ratatui_ruby/src/rendering.rs +4 -1
  34. data/ext/ratatui_ruby/src/terminal.rs +4 -6
  35. data/ext/ratatui_ruby/src/widgets/calendar.rs +81 -0
  36. data/ext/ratatui_ruby/src/widgets/chart.rs +253 -0
  37. data/ext/ratatui_ruby/src/widgets/list.rs +41 -4
  38. data/ext/ratatui_ruby/src/widgets/mod.rs +2 -1
  39. data/lib/ratatui_ruby/dsl.rb +62 -0
  40. data/lib/ratatui_ruby/schema/calendar.rb +26 -0
  41. data/lib/ratatui_ruby/schema/chart.rb +81 -0
  42. data/lib/ratatui_ruby/schema/list.rb +8 -2
  43. data/lib/ratatui_ruby/version.rb +1 -1
  44. data/lib/ratatui_ruby.rb +21 -1
  45. data/mise.toml +8 -0
  46. data/sig/ratatui_ruby/schema/calendar.rbs +13 -0
  47. data/sig/ratatui_ruby/schema/{line_chart.rbs → chart.rbs} +20 -1
  48. data/sig/ratatui_ruby/schema/list.rbs +4 -1
  49. data/tasks/bump/cargo_lockfile.rb +19 -0
  50. data/tasks/bump/manifest.rb +23 -0
  51. data/tasks/bump/ruby_gem.rb +39 -0
  52. data/tasks/bump/sem_ver.rb +28 -0
  53. data/tasks/bump.rake +45 -0
  54. data/tasks/doc.rake +24 -0
  55. data/tasks/extension.rake +12 -0
  56. data/tasks/lint.rake +49 -0
  57. data/tasks/rdoc_config.rb +15 -0
  58. data/tasks/resources/build.yml.erb +65 -0
  59. data/tasks/resources/index.html.erb +38 -0
  60. data/tasks/resources/rubies.yml +7 -0
  61. data/tasks/sourcehut.rake +29 -0
  62. data/tasks/test.rake +31 -0
  63. data/tasks/website/index_page.rb +28 -0
  64. data/tasks/website/version.rb +116 -0
  65. data/tasks/website/versioned_documentation.rb +48 -0
  66. data/tasks/website/website.rb +50 -0
  67. data/tasks/website.rake +26 -0
  68. metadata +51 -10
  69. data/.build.yml +0 -34
  70. data/.ruby-version +0 -1
  71. data/ext/ratatui_ruby/src/widgets/linechart.rs +0 -154
  72. data/lib/ratatui_ruby/schema/line_chart.rb +0 -41
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
4
+ # SPDX-License-Identifier: AGPL-3.0-or-later
5
+
6
+ require_relative "version"
7
+ require_relative "versioned_documentation"
8
+ require_relative "index_page"
9
+ require "fileutils"
10
+
11
+ class Website
12
+ def initialize(at: "public", project_name:, globs:, assets: [])
13
+ @destination = at
14
+ @project_name = project_name
15
+ @globs = globs
16
+ @assets = assets
17
+ end
18
+
19
+ def build
20
+ clean
21
+
22
+ versions.each do |version|
23
+ VersionedDocumentation.new(version).publish_to(
24
+ join(version.slug),
25
+ project_name: @project_name,
26
+ globs: @globs,
27
+ assets: @assets
28
+ )
29
+ end
30
+
31
+ IndexPage.new(versions).publish_to(join("index.html"), project_name: @project_name)
32
+
33
+ puts "Website built in #{@destination}/"
34
+ end
35
+
36
+ def versions
37
+ @versions ||= Version.all
38
+ end
39
+
40
+ private
41
+
42
+ def join(path)
43
+ File.join(@destination, path)
44
+ end
45
+
46
+ def clean
47
+ FileUtils.rm_rf(@destination)
48
+ FileUtils.mkdir_p(@destination)
49
+ end
50
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
4
+ # SPDX-License-Identifier: AGPL-3.0-or-later
5
+
6
+ require "erb"
7
+ require "fileutils"
8
+ require "tmpdir"
9
+ require_relative "rdoc_config"
10
+
11
+ namespace :website do
12
+ desc "Build documentation for main (current dir) and all git tags"
13
+ task :build do
14
+ require_relative "website/website"
15
+
16
+ spec = Gem::Specification.load(Dir["*.gemspec"].first)
17
+ globs = RDocConfig::RDOC_FILES + ["*.gemspec", "docs/images/**/*"]
18
+
19
+ Website.new(
20
+ at: "public",
21
+ project_name: spec.name,
22
+ globs: globs,
23
+ assets: ["docs/images"] # directories to copy
24
+ ).build
25
+ end
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratatui_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kerrick Long
@@ -46,10 +46,12 @@ extensions:
46
46
  - ext/ratatui_ruby/extconf.rb
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".build.yml"
49
+ - ".builds/ruby-3.2.yml"
50
+ - ".builds/ruby-3.3.yml"
51
+ - ".builds/ruby-3.4.yml"
52
+ - ".builds/ruby-4.0.0-preview3.yml"
50
53
  - ".pre-commit-config.yaml"
51
54
  - ".rubocop.yml"
52
- - ".ruby-version"
53
55
  - AGENTS.md
54
56
  - CHANGELOG.md
55
57
  - CODE_OF_CONDUCT.md
@@ -70,10 +72,14 @@ files:
70
72
  - docs/contributors/index.md
71
73
  - docs/images/examples-analytics.rb.png
72
74
  - docs/images/examples-box_demo.rb.png
75
+ - docs/images/examples-calendar_demo.rb.png
76
+ - docs/images/examples-chart_demo.rb.png
73
77
  - docs/images/examples-dashboard.rb.png
78
+ - docs/images/examples-list_styles.rb.png
74
79
  - docs/images/examples-login_form.rb.png
75
80
  - docs/images/examples-map_demo.rb.png
76
81
  - docs/images/examples-mouse_events.rb.png
82
+ - docs/images/examples-quickstart_lifecycle.rb.png
77
83
  - docs/images/examples-scrollbar_demo.rb.png
78
84
  - docs/images/examples-stock_ticker.rb.png
79
85
  - docs/images/examples-system_monitor.rb.png
@@ -81,16 +87,24 @@ files:
81
87
  - docs/quickstart.md
82
88
  - examples/analytics.rb
83
89
  - examples/box_demo.rb
90
+ - examples/calendar_demo.rb
91
+ - examples/chart_demo.rb
84
92
  - examples/dashboard.rb
93
+ - examples/list_styles.rb
85
94
  - examples/login_form.rb
86
95
  - examples/map_demo.rb
87
96
  - examples/mouse_events.rb
97
+ - examples/quickstart_dsl.rb
98
+ - examples/quickstart_lifecycle.rb
99
+ - examples/readme_usage.rb
88
100
  - examples/scrollbar_demo.rb
89
101
  - examples/stock_ticker.rb
90
102
  - examples/system_monitor.rb
91
103
  - examples/test_analytics.rb
92
104
  - examples/test_box_demo.rb
105
+ - examples/test_calendar_demo.rb
93
106
  - examples/test_dashboard.rb
107
+ - examples/test_list_styles.rb
94
108
  - examples/test_login_form.rb
95
109
  - examples/test_map_demo.rb
96
110
  - examples/test_stock_ticker.rb
@@ -107,12 +121,13 @@ files:
107
121
  - ext/ratatui_ruby/src/terminal.rs
108
122
  - ext/ratatui_ruby/src/widgets/barchart.rs
109
123
  - ext/ratatui_ruby/src/widgets/block.rs
124
+ - ext/ratatui_ruby/src/widgets/calendar.rs
110
125
  - ext/ratatui_ruby/src/widgets/canvas.rs
111
126
  - ext/ratatui_ruby/src/widgets/center.rs
127
+ - ext/ratatui_ruby/src/widgets/chart.rs
112
128
  - ext/ratatui_ruby/src/widgets/cursor.rs
113
129
  - ext/ratatui_ruby/src/widgets/gauge.rs
114
130
  - ext/ratatui_ruby/src/widgets/layout.rs
115
- - ext/ratatui_ruby/src/widgets/linechart.rs
116
131
  - ext/ratatui_ruby/src/widgets/list.rs
117
132
  - ext/ratatui_ruby/src/widgets/mod.rs
118
133
  - ext/ratatui_ruby/src/widgets/overlay.rs
@@ -122,16 +137,18 @@ files:
122
137
  - ext/ratatui_ruby/src/widgets/table.rs
123
138
  - ext/ratatui_ruby/src/widgets/tabs.rs
124
139
  - lib/ratatui_ruby.rb
140
+ - lib/ratatui_ruby/dsl.rb
125
141
  - lib/ratatui_ruby/output.rb
126
142
  - lib/ratatui_ruby/schema/bar_chart.rb
127
143
  - lib/ratatui_ruby/schema/block.rb
144
+ - lib/ratatui_ruby/schema/calendar.rb
128
145
  - lib/ratatui_ruby/schema/canvas.rb
129
146
  - lib/ratatui_ruby/schema/center.rb
147
+ - lib/ratatui_ruby/schema/chart.rb
130
148
  - lib/ratatui_ruby/schema/constraint.rb
131
149
  - lib/ratatui_ruby/schema/cursor.rb
132
150
  - lib/ratatui_ruby/schema/gauge.rb
133
151
  - lib/ratatui_ruby/schema/layout.rb
134
- - lib/ratatui_ruby/schema/line_chart.rb
135
152
  - lib/ratatui_ruby/schema/list.rb
136
153
  - lib/ratatui_ruby/schema/overlay.rb
137
154
  - lib/ratatui_ruby/schema/paragraph.rb
@@ -142,16 +159,18 @@ files:
142
159
  - lib/ratatui_ruby/schema/tabs.rb
143
160
  - lib/ratatui_ruby/test_helper.rb
144
161
  - lib/ratatui_ruby/version.rb
162
+ - mise.toml
145
163
  - sig/ratatui_ruby/ratatui_ruby.rbs
146
164
  - sig/ratatui_ruby/schema/bar_chart.rbs
147
165
  - sig/ratatui_ruby/schema/block.rbs
166
+ - sig/ratatui_ruby/schema/calendar.rbs
148
167
  - sig/ratatui_ruby/schema/canvas.rbs
149
168
  - sig/ratatui_ruby/schema/center.rbs
169
+ - sig/ratatui_ruby/schema/chart.rbs
150
170
  - sig/ratatui_ruby/schema/constraint.rbs
151
171
  - sig/ratatui_ruby/schema/cursor.rbs
152
172
  - sig/ratatui_ruby/schema/gauge.rbs
153
173
  - sig/ratatui_ruby/schema/layout.rbs
154
- - sig/ratatui_ruby/schema/line_chart.rbs
155
174
  - sig/ratatui_ruby/schema/list.rbs
156
175
  - sig/ratatui_ruby/schema/overlay.rbs
157
176
  - sig/ratatui_ruby/schema/paragraph.rbs
@@ -162,6 +181,25 @@ files:
162
181
  - sig/ratatui_ruby/schema/tabs.rbs
163
182
  - sig/ratatui_ruby/test_helper.rbs
164
183
  - sig/ratatui_ruby/version.rbs
184
+ - tasks/bump.rake
185
+ - tasks/bump/cargo_lockfile.rb
186
+ - tasks/bump/manifest.rb
187
+ - tasks/bump/ruby_gem.rb
188
+ - tasks/bump/sem_ver.rb
189
+ - tasks/doc.rake
190
+ - tasks/extension.rake
191
+ - tasks/lint.rake
192
+ - tasks/rdoc_config.rb
193
+ - tasks/resources/build.yml.erb
194
+ - tasks/resources/index.html.erb
195
+ - tasks/resources/rubies.yml
196
+ - tasks/sourcehut.rake
197
+ - tasks/test.rake
198
+ - tasks/website.rake
199
+ - tasks/website/index_page.rb
200
+ - tasks/website/version.rb
201
+ - tasks/website/versioned_documentation.rb
202
+ - tasks/website/website.rb
165
203
  - vendor/goodcop/base.yml
166
204
  homepage: https://sr.ht/~kerrick/ratatui_ruby/
167
205
  licenses:
@@ -173,17 +211,20 @@ metadata:
173
211
  changelog_uri: https://git.sr.ht/~kerrick/ratatui_ruby/tree/main/item/CHANGELOG.md
174
212
  mailing_list_uri: https://lists.sr.ht/~kerrick/ratatui_ruby-discuss
175
213
  source_code_uri: https://git.sr.ht/~kerrick/ratatui_ruby
176
- documentation_uri: https://man.sr.ht/~kerrick/ratatui_ruby/docs/
177
- wiki_uri: https://man.sr.ht/~kerrick/ratatui_ruby/docs/contributors/
214
+ documentation_uri: https://git.sr.ht/~kerrick/ratatui_ruby/tree/HEAD/docs/index.md
215
+ wiki_uri: https://man.sr.ht/~kerrick/ratatui_ruby/
178
216
  funding_uri: https://opencollective.com/ratatui
179
217
  rdoc_options: []
180
218
  require_paths:
181
219
  - lib
182
220
  required_ruby_version: !ruby/object:Gem::Requirement
183
221
  requirements:
184
- - - '='
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: 3.2.9
225
+ - - "<"
185
226
  - !ruby/object:Gem::Version
186
- version: 3.4.7
227
+ version: '5'
187
228
  required_rubygems_version: !ruby/object:Gem::Requirement
188
229
  requirements:
189
230
  - - ">="
data/.build.yml DELETED
@@ -1,34 +0,0 @@
1
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
2
- # SPDX-License-Identifier: AGPL-3.0-or-later
3
-
4
- image: archlinux
5
- packages:
6
- - ruby
7
- - rust
8
- - cargo
9
- - make
10
- - gcc
11
- - clang
12
- sources:
13
- - https://git.sr.ht/~kerrick/ratatui_ruby
14
- tasks:
15
- - setup: |
16
- cd ratatui_ruby
17
- export PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
18
- gem install --user-install bundler -v 2.6.9
19
- bundle config set --local path 'vendor/bundle'
20
- bundle install
21
- - test: |
22
- cd ratatui_ruby
23
- export PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
24
- bundle config set --local path 'vendor/bundle'
25
- # Compile the extension before running tests
26
- bundle exec rake compile
27
- # Run the test suite (Headless)
28
- bundle exec rake test
29
- - package: |
30
- cd ratatui_ruby
31
- export PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
32
- bundle config set --local path 'vendor/bundle'
33
- # Verify packaging works
34
- gem build ratatui_ruby.gemspec
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.4.7
@@ -1,154 +0,0 @@
1
- // SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
2
- // SPDX-License-Identifier: AGPL-3.0-or-later
3
-
4
- use crate::style::{parse_block, parse_color};
5
- use magnus::{prelude::*, Error, Value};
6
- use ratatui::{
7
- layout::Rect,
8
- style::{Color, Style},
9
- symbols,
10
- widgets::{Chart, Dataset},
11
- Frame,
12
- };
13
-
14
- pub fn render(frame: &mut Frame, area: Rect, node: Value) -> Result<(), Error> {
15
- let datasets_val: magnus::RArray = node.funcall("datasets", ())?;
16
- let x_labels_val: magnus::RArray = node.funcall("x_labels", ())?;
17
- let y_labels_val: magnus::RArray = node.funcall("y_labels", ())?;
18
- let y_bounds_val: magnus::RArray = node.funcall("y_bounds", ())?;
19
- let block_val: Value = node.funcall("block", ())?;
20
-
21
- let mut datasets = Vec::new();
22
- // We need to keep the data alive until the chart is rendered
23
- let mut data_storage: Vec<Vec<(f64, f64)>> = Vec::new();
24
- let mut name_storage: Vec<String> = Vec::new();
25
-
26
- for i in 0..datasets_val.len() {
27
- let ds_val: Value = datasets_val.entry(i as isize)?;
28
- let name: String = ds_val.funcall("name", ())?;
29
- let data_array: magnus::RArray = ds_val.funcall("data", ())?;
30
-
31
- let mut points = Vec::new();
32
- for j in 0..data_array.len() {
33
- let point_array_val: Value = data_array.entry(j as isize)?;
34
- let point_array = magnus::RArray::from_value(point_array_val).ok_or_else(|| {
35
- Error::new(magnus::exception::type_error(), "expected array for point")
36
- })?;
37
- let x_val: Value = point_array.entry(0)?;
38
- let y_val: Value = point_array.entry(1)?;
39
-
40
- let x: f64 = x_val.funcall("to_f", ())?;
41
- let y: f64 = y_val.funcall("to_f", ())?;
42
- points.push((x, y));
43
- }
44
-
45
- data_storage.push(points);
46
- name_storage.push(name);
47
- }
48
-
49
- for i in 0..data_storage.len() {
50
- let ds_val: Value = datasets_val.entry(i as isize)?;
51
- let color_val: Value = ds_val.funcall("color", ())?;
52
- let color_str: String = color_val.funcall("to_s", ())?;
53
- let color = parse_color(&color_str).unwrap_or(Color::White);
54
-
55
- let ds = Dataset::default()
56
- .name(name_storage[i].clone())
57
- .marker(symbols::Marker::Braille)
58
- .style(Style::default().fg(color))
59
- .data(&data_storage[i]);
60
- datasets.push(ds);
61
- }
62
-
63
- let mut x_labels = Vec::new();
64
- for i in 0..x_labels_val.len() {
65
- let label: String = x_labels_val.entry(i as isize)?;
66
- x_labels.push(ratatui::text::Span::from(label));
67
- }
68
-
69
- let mut y_labels = Vec::new();
70
- for i in 0..y_labels_val.len() {
71
- let label: String = y_labels_val.entry(i as isize)?;
72
- y_labels.push(ratatui::text::Span::from(label));
73
- }
74
-
75
- let y_bounds: [f64; 2] = [y_bounds_val.entry(0)?, y_bounds_val.entry(1)?];
76
-
77
- // Calculate x_bounds based on datasets if possible
78
- let mut min_x = 0.0;
79
- let mut max_x = 0.0;
80
- let mut first = true;
81
- for ds_data in &data_storage {
82
- for (x, _) in ds_data {
83
- if first {
84
- min_x = *x;
85
- max_x = *x;
86
- first = false;
87
- } else {
88
- if *x < min_x {
89
- min_x = *x;
90
- }
91
- if *x > max_x {
92
- max_x = *x;
93
- }
94
- }
95
- }
96
- }
97
-
98
- // Ensure there's some range
99
- if min_x == max_x {
100
- max_x = min_x + 1.0;
101
- }
102
-
103
- let x_axis = ratatui::widgets::Axis::default()
104
- .labels(x_labels)
105
- .bounds([min_x, max_x]);
106
-
107
- let y_axis = ratatui::widgets::Axis::default()
108
- .labels(y_labels)
109
- .bounds(y_bounds);
110
-
111
- let mut chart = Chart::new(datasets).x_axis(x_axis).y_axis(y_axis);
112
-
113
- if !block_val.is_nil() {
114
- chart = chart.block(parse_block(block_val)?);
115
- }
116
-
117
- frame.render_widget(chart, area);
118
- Ok(())
119
- }
120
-
121
- #[cfg(test)]
122
- mod tests {
123
- use super::*;
124
- use ratatui::buffer::Buffer;
125
- use ratatui::widgets::{Axis, Chart, Dataset, Widget};
126
-
127
- #[test]
128
- fn test_linechart_rendering() {
129
- let data = vec![(0.0, 0.0), (1.0, 1.0)];
130
- let datasets = vec![Dataset::default().name("TestDS").data(&data)];
131
- let chart = Chart::new(datasets)
132
- .x_axis(
133
- Axis::default()
134
- .bounds([0.0, 1.0])
135
- .labels(vec!["XMIN".into(), "XMAX".into()]),
136
- )
137
- .y_axis(
138
- Axis::default()
139
- .bounds([0.0, 1.0])
140
- .labels(vec!["YMIN".into(), "YMAX".into()]),
141
- );
142
- let mut buf = Buffer::empty(Rect::new(0, 0, 40, 20)); // Larger buffer
143
- chart.render(Rect::new(0, 0, 40, 20), &mut buf);
144
- // Should have chart rendered (braille characters)
145
- assert!(buf.content().iter().any(|c| c.symbol() != " "));
146
- // Should have labels
147
- let content = buf.content().iter().map(|c| c.symbol()).collect::<String>();
148
- assert!(content.contains("XMIN"));
149
- assert!(content.contains("XMAX"));
150
- assert!(content.contains("YMIN"));
151
- assert!(content.contains("YMAX"));
152
- assert!(content.contains("TestDS"));
153
- }
154
- }
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
4
- # SPDX-License-Identifier: AGPL-3.0-or-later
5
-
6
- module RatatuiRuby
7
- # A single line on a chart.
8
- #
9
- # [name] The name of the dataset.
10
- # [data] Array of arrays [[x, y], [x, y]] (Floats).
11
- # [color] The color of the line.
12
- class Dataset < Data.define(:name, :data, :color)
13
- # Creates a new Dataset.
14
- # [name] The name of the dataset.
15
- # [data] Array of arrays [[x, y], [x, y]] (Floats).
16
- # [color] The color of the line.
17
- def initialize(name:, data:, color: "white")
18
- super
19
- end
20
- end
21
-
22
- # A complex chart widget.
23
- #
24
- # [datasets] Array of Dataset objects.
25
- # [x_labels] Array of Strings for the X-axis labels.
26
- # [y_labels] Array of Strings for the Y-axis labels.
27
- # [y_bounds] Array of two Floats [min, max] for the Y-axis.
28
- # [block] Optional block widget to wrap the chart.
29
- class LineChart < Data.define(:datasets, :x_labels, :y_labels, :y_bounds, :block)
30
- # Creates a new LineChart widget.
31
- #
32
- # [datasets] Array of Dataset objects.
33
- # [x_labels] Array of Strings for the X-axis labels.
34
- # [y_labels] Array of Strings for the Y-axis labels.
35
- # [y_bounds] Array of two Floats [min, max] for the Y-axis.
36
- # [block] Optional block widget to wrap the chart.
37
- def initialize(datasets:, x_labels: [], y_labels: [], y_bounds: [0.0, 100.0], block: nil)
38
- super
39
- end
40
- end
41
- end