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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/VERSION +1 -1
- data/examples/graphs_and_charts/basic_line_graph_relative.rb +1 -0
- data/glimmer-libui-cc-graphs_and_charts.gemspec +3 -3
- data/lib/glimmer/view/line_graph.rb +20 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2c272045c6c7fce0af891fe8cb87940a5c2c4e51c8f80fd9cb29ae20d19f429
|
4
|
+
data.tar.gz: 302c1b38be9fe0b96501e3eae432f7ba06ba73da64eb83f8d63834d2d12381e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
# Graphs and Charts 0.4.2 (Alpha)
|
2
2
|
## [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui) Custom Controls
|
3
3
|
[](http://badge.fury.io/rb/glimmer-libui-cc-graphs_and_charts)
|
4
4
|
[](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.
|
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
|
+
0.4.2
|
@@ -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.
|
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.
|
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-
|
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|
|
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
|
-
|
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
|
-
|
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.
|
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-
|
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
|