glimmer-libui-cc-graphs_and_charts 0.4.1 → 0.4.2

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: 948c4d8554c7e5fb57b91c76595312f215a6de6b28bf47b90589049cefcd13e0
4
- data.tar.gz: e80fa96b958cf4adfbb956daff54da211840811198c2a97f37b336873ff8c406
3
+ metadata.gz: d2c272045c6c7fce0af891fe8cb87940a5c2c4e51c8f80fd9cb29ae20d19f429
4
+ data.tar.gz: 302c1b38be9fe0b96501e3eae432f7ba06ba73da64eb83f8d63834d2d12381e2
5
5
  SHA512:
6
- metadata.gz: 2bae6ff11171d38a2cb7369af7b042972390786087754fd1e2a73fcd280b05b174c76c0766ce61ab31b8204ee77af6fecb7f3d3161784df3a49ae5b3eb5540f8
7
- data.tar.gz: d95518f90db54705575b50b8beea6e9875f7f613ae8f26052aec65c6100c8274ddd0220795fc2d735e02a2f7a53a6dfc6561170945bfed288354c1e4495ddd7b
6
+ metadata.gz: f9c18491aa8a799e13172ddbc63a44f9c44aced1d69de0b35f55539b28387437e84c370872216b77a2dcd2ffa470dab37ae6962d998fed98b07f2b4f9ca9a13e
7
+ data.tar.gz: bbee30db1ed485df4b84eed78d91e128df3d0bd79815f0e9b9e568b54bcdc756e629cc381349f4f6933455ef9d273696ca7ebe885830191230c39ca6514b66dc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.4.2
4
+
5
+ - Line Graph relative mode with `reverse_x` as `false` adds x_interval_in_seconds time positively.
6
+ - examples/graphs_and_charts/basic_line_graph_relative.rb demonstrates Line Graph in relative mode with `reverse_x` as `false`
7
+
3
8
  ## 0.4.1
4
9
 
5
10
  - Support `reverse_x` as `false` when rendering a line graph in relative mode (without `display_attributes_on_hover: true` for now).
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Graphs and Charts 0.4.1 (Alpha)
1
+ # Graphs and Charts 0.4.2 (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.1'
19
+ gem 'glimmer-libui-cc-graphs_and_charts', '~> 0.4.2'
20
20
  ```
21
21
 
22
22
  Run:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -35,6 +35,7 @@ class BasicLineGraphRelative
35
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
36
  },
37
37
  ],
38
+ display_attributes_on_hover: true,
38
39
  )
39
40
 
40
41
  on_content_size_changed do
@@ -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.1 ruby lib
5
+ # stub: glimmer-libui-cc-graphs_and_charts 0.4.2 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.1".freeze
9
+ s.version = "0.4.2".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-02-01"
14
+ s.date = "2025-02-23"
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 = [
@@ -352,6 +352,7 @@ module Glimmer
352
352
  end
353
353
 
354
354
  def reverse_x_in_points(points)
355
+ # TODO consider caching results based on points
355
356
  # TODO look into optimizing operations below by not iterating 3 times (perhaps one iteration could do everything)
356
357
  points = points.map do |point|
357
358
  point.merge(x: width_drawable.to_f - point[:x])
@@ -508,7 +509,15 @@ module Glimmer
508
509
  closest_point = point_distances_from_hover_point.min_by(&:last).first
509
510
  end
510
511
  else
511
- closest_points = lines.map { |line| @points[line][@closest_point_index] }
512
+ closest_points = lines.map { |line|
513
+ line_points = @points[line]
514
+ if !reverse_x
515
+ line_points = reverse_x_in_points(line_points)
516
+ line_points[line_points.size - @closest_point_index]
517
+ else
518
+ line_points[@closest_point_index]
519
+ end
520
+ }
512
521
  end
513
522
  closest_x = closest_points[0]&.[](:x)
514
523
  line(closest_x, graph_padding_height, closest_x, height - graph_padding_height) {
@@ -525,7 +534,11 @@ module Glimmer
525
534
  stroke stroke_value
526
535
  }
527
536
  end
528
- text_label = formatted_x_value(@closest_point_index, closest_points)
537
+ if !reverse_x
538
+ text_label = formatted_x_value(@closest_point_index, closest_points)
539
+ else
540
+ text_label = formatted_x_value(@closest_point_index, closest_points)
541
+ end
529
542
  text_label_width = estimate_width_of_text(text_label, DEFAULT_GRAPH_FONT_MARKER_TEXT)
530
543
  lines_with_closest_points = lines.each_with_index.map do |line, index|
531
544
  next if closest_points[index].nil?
@@ -537,7 +550,11 @@ module Glimmer
537
550
  line_point = closest_points[index]
538
551
  "#{line[:name]}: #{line_point[:y_value]}"
539
552
  else
540
- "#{line[:name]}: #{line[:y_values][@closest_point_index]}"
553
+ if !reverse_x
554
+ "#{line[:name]}: #{line[:y_values][closest_points.size - 2 - @closest_point_index]}"
555
+ else
556
+ "#{line[:name]}: #{line[:y_values][@closest_point_index]}"
557
+ end
541
558
  end
542
559
  end
543
560
  closest_point_text_widths = closest_point_texts.map do |text|
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.1
4
+ version: 0.4.2
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-02-01 00:00:00.000000000 Z
11
+ date: 2025-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer-dsl-libui