glimmer-libui-cc-graphs_and_charts 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94aec489e11216cb8904df362b1b99634dcf7ed4fa8aad2c629ff0afcf516d9c
4
- data.tar.gz: ea39289228f18ee1596aaab82da7ba432250074de094903c741786c0195de75b
3
+ metadata.gz: aefbc0c06b3968b4e633e3d923cf886e64421d5debea0e0e8a2376a54b45df86
4
+ data.tar.gz: beb20ca4b10e5ff0187becd7e1d3aeb087033a35093ea932dcde4a4b980ae22f
5
5
  SHA512:
6
- metadata.gz: 4399555f8b93a1af2409f8b6b6c8ddbe268eaff2eadb575de3107768a6c3f173fe74b0e8bae12c5e0ddf12ed7053d01492a71feb67f98a9fc24cde0f493d8597
7
- data.tar.gz: e7d5a072f1475ec0710fdd5a76f0cd1cf98fd2dca7231a38bd42a80f4e56c5fbde16f8c5d79b85634329e29833684d6c5d77c7f98cfcf739e479de9ff208ece1
6
+ metadata.gz: 619d28542b4a45eaa32b1f71e912ca24e11ba48ececef50bb7a5503ee0854a17591df78b2e6202f90625b747947b661f5a247e8eeb4c4fdf6ef1cf7ae8bbce6f
7
+ data.tar.gz: 1d48203f5a1a03e0c84eb60301085bd89c4cf589a41214b825d07ea22afa2a910fc331f80a62802e1c7e2b2d4f29b0daab63150da1cbb8c48eed76f27926b331
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.1.3
4
+
5
+ - Fix issue with crashing if lines had points that did not share the same x-axis values as opposed to all points in all lines falling on the same x-axis values
6
+
3
7
  ## 0.1.2
4
8
 
5
9
  - Fix issue with crashing if the mouse hovers over a graph without any points yet
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Graphs and Charts 0.1.2 (Alpha)
1
+ # Graphs and Charts 0.1.3 (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)
@@ -12,7 +12,7 @@ Graphs and Charts (Custom Controls) for [Glimmer DSL for LibUI](https://github.c
12
12
  Add this line to Bundler `Gemfile`:
13
13
 
14
14
  ```ruby
15
- gem 'glimmer-libui-cc-graphs_and_charts', '~> 0.1.2'
15
+ gem 'glimmer-libui-cc-graphs_and_charts', '~> 0.1.3'
16
16
  ```
17
17
 
18
18
  Run:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -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.1.2 ruby lib
5
+ # stub: glimmer-libui-cc-graphs_and_charts 0.1.3 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.1.2"
9
+ s.version = "0.1.3".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 = "2023-12-18"
14
+ s.date = "2023-12-19"
15
15
  s.description = "Graphs and Charts (Custom Controls) for Glimmer DSL for LibUI, like Line Graph.".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -31,14 +31,14 @@ Gem::Specification.new do |s|
31
31
  ]
32
32
  s.homepage = "http://github.com/AndyObtiva/glimmer-libui-cc-graphs_and_charts".freeze
33
33
  s.licenses = ["MIT".freeze]
34
- s.rubygems_version = "3.4.6".freeze
34
+ s.rubygems_version = "3.5.1".freeze
35
35
  s.summary = "Graphs and Charts - Glimmer DSL for LibUI Custom Controls".freeze
36
36
 
37
37
  s.specification_version = 4
38
38
 
39
- s.add_runtime_dependency(%q<glimmer-dsl-libui>.freeze, ["~> 0.11"])
40
- s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
41
- s.add_development_dependency(%q<juwelier>.freeze, ["= 2.4.9"])
42
- s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
39
+ s.add_runtime_dependency(%q<glimmer-dsl-libui>.freeze, ["~> 0.11".freeze])
40
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0".freeze])
41
+ s.add_development_dependency(%q<juwelier>.freeze, ["= 2.4.9".freeze])
42
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
43
43
  end
44
44
 
@@ -331,6 +331,8 @@ module Glimmer
331
331
  stroke graph_stroke_hover_line
332
332
  }
333
333
  closest_points.each_with_index do |closest_point, index|
334
+ next unless closest_point && closest_point[:x] && closest_point[:y]
335
+
334
336
  circle(closest_point[:x], closest_point[:y], 4) {
335
337
  fill lines[index][:stroke]
336
338
  }
@@ -340,7 +342,12 @@ module Glimmer
340
342
  end
341
343
  text_label = formatted_x_value(@closest_point_index)
342
344
  text_label_width = estimate_width_of_text(text_label, DEFAULT_GRAPH_FONT_MARKER_TEXT)
343
- closest_point_texts = lines.map { |line| "#{line[:name]}: #{line[:y_values][@closest_point_index]}" }
345
+ lines_with_closest_points = lines.each_with_index.map do |line, index|
346
+ next if closest_points[index].nil?
347
+
348
+ line
349
+ end
350
+ closest_point_texts = lines_with_closest_points.map { |line| "#{line[:name]}: #{line[:y_values][@closest_point_index]}" }
344
351
  closest_point_text_widths = closest_point_texts.map do |text|
345
352
  estimate_width_of_text(text, graph_font_marker_text)
346
353
  end
@@ -348,7 +355,7 @@ module Glimmer
348
355
  square_to_label_padding = 10.0
349
356
  label_padding = 10.0
350
357
  text_label_x = width - graph_padding_width - text_label_width - label_padding -
351
- (lines.size*(square_size + square_to_label_padding) + (lines.size - 1)*label_padding + closest_point_text_widths.sum)
358
+ (lines_with_closest_points.size*(square_size + square_to_label_padding) + (lines_with_closest_points.size - 1)*label_padding + closest_point_text_widths.sum)
352
359
  text_label_y = height + graph_padding_height
353
360
 
354
361
  text(text_label_x, text_label_y, text_label_width) {
@@ -359,11 +366,11 @@ module Glimmer
359
366
  }
360
367
 
361
368
  relative_x = text_label_x + text_label_width
362
- lines.size.times do |index|
369
+ lines_with_closest_points.size.times do |index|
363
370
  square_x = relative_x + label_padding
364
371
 
365
372
  square(square_x, text_label_y + 2, square_size) {
366
- fill lines[index][:stroke]
373
+ fill lines_with_closest_points[index][:stroke]
367
374
  }
368
375
 
369
376
  attribute_label_x = square_x + square_size + square_to_label_padding
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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-18 00:00:00.000000000 Z
11
+ date: 2023-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer-dsl-libui
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.4.6
106
+ rubygems_version: 3.5.1
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Graphs and Charts - Glimmer DSL for LibUI Custom Controls