glimmer-libui-cc-graphs_and_charts 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '01195bf257b2d2c5d68720d762b2787e56824304a1524ddee62bd6107cd4ce87'
4
- data.tar.gz: 55118796cfc077ee9265f35f5126ef51b3a4ec9661eca624f098194c13136bca
3
+ metadata.gz: 948c4d8554c7e5fb57b91c76595312f215a6de6b28bf47b90589049cefcd13e0
4
+ data.tar.gz: e80fa96b958cf4adfbb956daff54da211840811198c2a97f37b336873ff8c406
5
5
  SHA512:
6
- metadata.gz: cb736fcd7e72aba035fa0709c74d68fe5d4ac5fceb4baca02541aa8a6e65b62f4383af211457886413bac2f38852b4f31a81f99b2e70e8ae99a8abe4537ea53b
7
- data.tar.gz: 605148fa95182c42c31c31eb7932e452ebdbc54806b1b8cbb51fbdb5f5fe1b4dd1a6021efad71623ded0eeb5a9481d4065b120bc25c7c209efd2df29cc377e57
6
+ metadata.gz: 2bae6ff11171d38a2cb7369af7b042972390786087754fd1e2a73fcd280b05b174c76c0766ce61ab31b8204ee77af6fecb7f3d3161784df3a49ae5b3eb5540f8
7
+ data.tar.gz: d95518f90db54705575b50b8beea6e9875f7f613ae8f26052aec65c6100c8274ddd0220795fc2d735e02a2f7a53a6dfc6561170945bfed288354c1e4495ddd7b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.4.1
4
+
5
+ - Support `reverse_x` as `false` when rendering a line graph in relative mode (without `display_attributes_on_hover: true` for now).
6
+ - Add new `examples/graphs_and_charts/basic_line_graph_relative.rb` example that renders line graphs naturally from left to right (with reverse_x not specified, meaning having value `false`).
7
+
3
8
  ## 0.4.0
4
9
 
5
10
  - Support `reverse_x` option; when `false`, line graphs are drawn naturally from left to right, and when `true`, line graphs are drawn like before from right to left.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Graphs and Charts 0.4.0 (Alpha)
1
+ # Graphs and Charts 0.4.1 (Alpha)
2
2
  ## [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui) Custom Controls
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-libui-cc-graphs_and_charts.svg)](http://badge.fury.io/rb/glimmer-libui-cc-graphs_and_charts)
4
4
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -16,7 +16,7 @@ Graphs and Charts (Custom Controls for [Glimmer DSL for LibUI](https://github.co
16
16
  Add this line to Bundler `Gemfile`:
17
17
 
18
18
  ```ruby
19
- gem 'glimmer-libui-cc-graphs_and_charts', '~> 0.4.0'
19
+ gem 'glimmer-libui-cc-graphs_and_charts', '~> 0.4.1'
20
20
  ```
21
21
 
22
22
  Run:
@@ -137,6 +137,8 @@ Note that you can use in absolute mode or relative mode for determining x-axis v
137
137
  - Absolute Mode: pass `values` which maps x-axis values to y-axis values
138
138
  - Relative Mode: pass `y_values`, `x_value_start`, and `x_interval_in_seconds` (x-axis values are calculated automatically in a uniform way from `x_value_start` deducting `x_interval_in_seconds`)
139
139
 
140
+ Look into [lib/glimmer/view/line_graph.rb](/lib/glimmer/view/line_graph.rb) to learn about all supported options.
141
+
140
142
  **Absolute Mode:**
141
143
 
142
144
  It supports any `Numeric` y-axis values in addition to `Time` x-axis values.
@@ -216,6 +218,38 @@ line_graph(
216
218
 
217
219
  ![basic line graph](/screenshots/glimmer-libui-cc-graphs_and_charts-mac-basic-line-graph-reverse-x.png)
218
220
 
221
+ **Relative Mode:**
222
+
223
+ Currently, it only supports `Integer` y-axis values in addition to `Time` x-axis values.
224
+
225
+ ```ruby
226
+ line_graph(
227
+ width: 900,
228
+ height: 300,
229
+ graph_point_distance: :width_divided_by_point_count,
230
+ lines: [
231
+ {
232
+ name: 'Feature A',
233
+ stroke: [163, 40, 39, thickness: 2],
234
+ x_value_start: @start_time,
235
+ x_interval_in_seconds: 8,
236
+ x_value_format: -> (time) {time.strftime("%a %d %b %Y %T GMT")},
237
+ y_values: [80, 36, 10, 60, 20, 110, 16, 5, 36, 1, 77, 15, 3, 34, 8, 63, 12, 17, 90, 28, 70]
238
+ },
239
+ {
240
+ name: 'Feature B',
241
+ stroke: [47, 109, 104, thickness: 2],
242
+ x_value_start: @start_time,
243
+ x_interval_in_seconds: 8,
244
+ x_value_format: -> (time) {time.strftime("%a %d %b %Y %T GMT")},
245
+ y_values: [62, 0, 90, 0, 0, 27, 0, 56, 0, 0, 24, 0, 60, 0, 30, 0, 47, 0, 38, 90, 0]
246
+ },
247
+ ],
248
+ )
249
+ ```
250
+
251
+ ![basic line graph relative](/screenshots/glimmer-libui-cc-graphs_and_charts-mac-basic-line-graph-relative.png)
252
+
219
253
  **Relative Mode (reverse x):**
220
254
 
221
255
  Currently, it only supports `Integer` y-axis values in addition to `Time` x-axis values.
@@ -250,8 +284,6 @@ line_graph(
250
284
 
251
285
  ![basic line graph relative](/screenshots/glimmer-libui-cc-graphs_and_charts-mac-basic-line-graph-relative-reverse-x.png)
252
286
 
253
- Look into [lib/glimmer/view/line_graph.rb](/lib/glimmer/view/line_graph.rb) to learn about all supported options.
254
-
255
287
  **Basic Line Graph Example:**
256
288
 
257
289
  [examples/graphs_and_charts/basic_line_graph.rb](/examples/graphs_and_charts/basic_line_graph.rb)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -0,0 +1,48 @@
1
+ # This line is only needed when running the example from inside the project directory
2
+ $LOAD_PATH.prepend(File.expand_path(File.join(__dir__, '..', '..', 'lib'))) if File.exist?(File.join(__dir__, '..', '..', 'lib'))
3
+
4
+ require 'glimmer-dsl-libui'
5
+ require 'glimmer/view/line_graph'
6
+
7
+ class BasicLineGraphRelative
8
+ include Glimmer::LibUI::Application
9
+
10
+ before_body do
11
+ @start_time = Time.now
12
+ end
13
+
14
+ body {
15
+ window('Basic Line Graph Relative', 900, 330) { |main_window|
16
+ @line_graph = line_graph(
17
+ width: 900,
18
+ height: 300,
19
+ graph_point_distance: :width_divided_by_point_count,
20
+ lines: [
21
+ {
22
+ name: 'Feature A',
23
+ stroke: [163, 40, 39, thickness: 2],
24
+ x_value_start: @start_time,
25
+ x_interval_in_seconds: 8,
26
+ x_value_format: -> (time) {time.strftime("%a %d %b %Y %T GMT")},
27
+ y_values: [80, 36, 10, 60, 20, 110, 16, 5, 36, 1, 77, 15, 3, 34, 8, 63, 12, 17, 90, 28, 70]
28
+ },
29
+ {
30
+ name: 'Feature B',
31
+ stroke: [47, 109, 104, thickness: 2],
32
+ x_value_start: @start_time,
33
+ x_interval_in_seconds: 8,
34
+ x_value_format: -> (time) {time.strftime("%a %d %b %Y %T GMT")},
35
+ y_values: [62, 0, 90, 0, 0, 27, 0, 56, 0, 0, 24, 0, 60, 0, 30, 0, 47, 0, 38, 90, 0]
36
+ },
37
+ ],
38
+ )
39
+
40
+ on_content_size_changed do
41
+ @line_graph.width = main_window.content_size[0]
42
+ @line_graph.height = main_window.content_size[1] - 30
43
+ end
44
+ }
45
+ }
46
+ end
47
+
48
+ BasicLineGraphRelative.launch
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-libui-cc-graphs_and_charts 0.4.0 ruby lib
5
+ # stub: glimmer-libui-cc-graphs_and_charts 0.4.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-libui-cc-graphs_and_charts".freeze
9
- s.version = "0.4.0".freeze
9
+ s.version = "0.4.1".freeze
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Andy Maleh".freeze]
14
- s.date = "2025-01-27"
14
+ s.date = "2025-02-01"
15
15
  s.description = "Graphs and Charts (Glimmer DSL for LibUI Custom Controls), like Line Graph, Bar Chart, and Bubble Chart.".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "examples/graphs_and_charts/basic_bar_chart.rb",
28
28
  "examples/graphs_and_charts/basic_bubble_chart.rb",
29
29
  "examples/graphs_and_charts/basic_line_graph.rb",
30
+ "examples/graphs_and_charts/basic_line_graph_relative.rb",
30
31
  "examples/graphs_and_charts/basic_line_graph_relative_reverse_x.rb",
31
32
  "examples/graphs_and_charts/basic_line_graph_reverse_x.rb",
32
33
  "glimmer-libui-cc-graphs_and_charts.gemspec",
@@ -357,9 +357,10 @@ module Glimmer
357
357
  point.merge(x: width_drawable.to_f - point[:x])
358
358
  end
359
359
  min_point = points.min_by {|point| point[:x]}
360
- if min_point[:x] < 0
360
+ min_point_x = min_point[:x]
361
+ if min_point_x < 0
361
362
  points.each do |point|
362
- point[:x] = point[:x] - min_point[:x]
363
+ point[:x] = point[:x] - min_point_x
363
364
  end
364
365
  end
365
366
  points.each do |point|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-libui-cc-graphs_and_charts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-27 00:00:00.000000000 Z
11
+ date: 2025-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer-dsl-libui
@@ -89,6 +89,7 @@ files:
89
89
  - examples/graphs_and_charts/basic_bar_chart.rb
90
90
  - examples/graphs_and_charts/basic_bubble_chart.rb
91
91
  - examples/graphs_and_charts/basic_line_graph.rb
92
+ - examples/graphs_and_charts/basic_line_graph_relative.rb
92
93
  - examples/graphs_and_charts/basic_line_graph_relative_reverse_x.rb
93
94
  - examples/graphs_and_charts/basic_line_graph_reverse_x.rb
94
95
  - glimmer-libui-cc-graphs_and_charts.gemspec