heatmap-builder 0.1.0 → 0.4.3
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/.github/workflows/ci.yml +2 -5
- data/.gitignore +3 -0
- data/CHANGELOG.md +101 -3
- data/Gemfile.lock +35 -24
- data/README.md +325 -52
- data/Rakefile +15 -0
- data/bin/generate_examples +177 -0
- data/examples/calendar_blue_ocean.svg +1 -0
- data/examples/calendar_cell_borders.svg +1 -0
- data/examples/calendar_default.svg +1 -0
- data/examples/calendar_github_style.svg +1 -3
- data/examples/calendar_month_spacing_rounded.svg +1 -0
- data/examples/calendar_no_borders.svg +1 -0
- data/examples/calendar_purple_vibes.svg +1 -0
- data/examples/calendar_red_to_green.svg +1 -0
- data/examples/calendar_rounded_corners.svg +1 -0
- data/examples/calendar_rounded_corners_max_radius.svg +1 -0
- data/examples/calendar_sunday_start.svg +1 -3
- data/examples/calendar_warm_sunset.svg +1 -0
- data/examples/calendar_with_outside_cells.svg +1 -3
- data/heatmap-builder.gemspec +5 -4
- data/lib/heatmap-builder.rb +24 -6
- data/lib/heatmap_builder/calendar.rb +426 -0
- data/lib/heatmap_builder/color_helpers.rb +150 -0
- data/lib/heatmap_builder/svg_helpers.rb +82 -0
- data/lib/heatmap_builder/value_conversion.rb +68 -0
- data/lib/heatmap_builder/version.rb +1 -1
- metadata +38 -15
- data/examples/generate_samples.rb +0 -114
- data/examples/large_cells.svg +0 -3
- data/examples/weekly_progress.svg +0 -3
- data/lib/heatmap_builder/calendar_heatmap_builder.rb +0 -295
- data/lib/heatmap_builder/linear_heatmap_builder.rb +0 -128
- data/mise.toml +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6493e6ea0c3c5fd533269a55e6cb18c8df0a65ddad86aab5061c6d5cf57c5586
|
|
4
|
+
data.tar.gz: fd5ae27f32ec084c3414d8f26a7def6c45bedef66b7266423ddd9fc3ec3df458
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1424b3fc448ef0d2a0afac402f87617fc981a179cc5fad4a6883585950f41a885b052680da36ec203bc071fab010c336b9c362b6c72ecbbc5680643f47d938ff
|
|
7
|
+
data.tar.gz: 8702e0d38c802162393f0185b6e485e504203a119115f4d92e43e72b583d32202bf61c6264b7e5df9ae3a6b77ac7526d92d2b21a253ac0893695ef0348109e7f
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
strategy:
|
|
13
13
|
matrix:
|
|
14
|
-
ruby-version: ['3.
|
|
14
|
+
ruby-version: ['3.3', '3.4', '4.0']
|
|
15
15
|
|
|
16
16
|
steps:
|
|
17
17
|
- uses: actions/checkout@v4
|
|
@@ -23,10 +23,7 @@ jobs:
|
|
|
23
23
|
bundler-cache: true
|
|
24
24
|
|
|
25
25
|
- name: Run tests
|
|
26
|
-
run:
|
|
27
|
-
bundle exec ruby -Ilib:test test/heatmap_builder_test.rb
|
|
28
|
-
bundle exec ruby -Ilib:test test/calendar_heatmap_builder_test.rb
|
|
29
|
-
bundle exec ruby -Ilib:test test/linear_heatmap_builder_test.rb
|
|
26
|
+
run: bundle exec rake test
|
|
30
27
|
|
|
31
28
|
lint:
|
|
32
29
|
runs-on: ubuntu-latest
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -7,16 +7,114 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.3] - 2026-06-15
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Calendar month labels now always sit above the first full week of the month.
|
|
14
|
+
Previously, with `month_spacing: 0`, a label could land on the straddling
|
|
15
|
+
column shared by two months; the label position is now derived from each
|
|
16
|
+
week's `week_start`, so straddling weeks defer the label to the next full week.
|
|
17
|
+
- A month is no longer labeled when its only visible week is incomplete (a
|
|
18
|
+
leading or trailing sliver at the edge of the data range). Previously such a
|
|
19
|
+
label could overlap the next month's label when the partial month occupied a
|
|
20
|
+
single column. Labels are now placed only on a fully visible week.
|
|
21
|
+
|
|
22
|
+
## [0.4.2] - 2026-06-15
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- New `border_lightness_factor` option controls how the cell border color is derived
|
|
26
|
+
from each cell's color by scaling its OKLCH lightness. Setting it to `1` makes
|
|
27
|
+
the border match the cell color, in which case the (now invisible) border is
|
|
28
|
+
omitted from the SVG entirely. Defaults to `0.9`, preserving previous output.
|
|
29
|
+
|
|
30
|
+
## [0.4.1] - 2026-06-13
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Default value-to-score conversion now reserves score `0` for empty cells
|
|
34
|
+
(zero or missing values) and maps every non-zero value into the `1..max_score`
|
|
35
|
+
range, so the smallest amount of activity is always visually distinct from an
|
|
36
|
+
empty day. Regenerated `examples/*.svg` to reflect the new bucketing.
|
|
37
|
+
- Auto-calculated `value_min` now anchors on the smallest non-zero value instead
|
|
38
|
+
of zero. Because zero is the reserved empty bucket, this keeps the lightest
|
|
39
|
+
activity color reachable rather than stranding it on values that never occur.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- Example calendar heatmaps misrendered high-activity days. The generator passed
|
|
43
|
+
raw values straight through as `scores:`, so any value beyond the palette's
|
|
44
|
+
color count wrapped around via modulo (`score_to_color`) and the busiest days
|
|
45
|
+
could render as nearly empty cells. The examples now feed values through the
|
|
46
|
+
bucketing conversion, so cell intensity increases monotonically with the
|
|
47
|
+
underlying value.
|
|
48
|
+
|
|
49
|
+
## [0.4.0] - 2026-06-12
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
- Tooltip support for calendar cells via the `tooltip:` option. Accepts a callable
|
|
53
|
+
invoked per active cell with `date:`, `score:`, and `value:` keyword arguments;
|
|
54
|
+
the return value becomes the tooltip text.
|
|
55
|
+
- Native SVG `<title>` element is always emitted as a zero-JS browser fallback.
|
|
56
|
+
- `tooltip_attribute:` option (default `"data-tooltip"`) controls which `data-*`
|
|
57
|
+
attribute is written on the cell's `<g>` wrapper for JS tooltip library pickup.
|
|
58
|
+
Set to `nil` to suppress the data attribute and use only the native fallback.
|
|
59
|
+
|
|
60
|
+
## [0.3.1] - 2026-06-11
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
- Relaxed `rake` and `minitest` development dependency constraints from `~>` to `>=` to allow future major versions
|
|
64
|
+
|
|
65
|
+
## [0.3.0] - 2026-06-11
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
- Dropped support for Ruby 3.0, 3.1, and 3.2 (all EOL); minimum required version is now 3.3
|
|
69
|
+
- Updated all dependencies to latest stable versions
|
|
70
|
+
- Updated Bundler constraint from `~> 2.0` to `>= 2.0`; locked to Bundler 4.0.14
|
|
71
|
+
- CI matrix updated to Ruby 3.3, 3.4, and 4.0
|
|
72
|
+
|
|
73
|
+
## [0.2.0] - 2025-10-02
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
- Support for raw numeric values with automatic score calculation using linear distribution
|
|
77
|
+
- `values:` parameter as alternative to `scores:` for both linear and calendar heatmaps
|
|
78
|
+
- `value_min:` and `value_max:` options for explicit boundary control
|
|
79
|
+
- `value_to_score:` option for custom value-to-score conversion functions
|
|
80
|
+
- Automatic boundary detection from input data when not explicitly specified
|
|
81
|
+
- Dynamic color palette generation using OKLCH color space interpolation
|
|
82
|
+
- Rounded corners support for heatmap cells via `corner_radius` option
|
|
83
|
+
- Test coverage reporting with SimpleCov
|
|
84
|
+
- Snapshot testing for visual regression testing
|
|
85
|
+
- YARD documentation for public API methods
|
|
86
|
+
- Logarithmic scale example for custom scoring logic
|
|
87
|
+
- Detailed options documentation in README
|
|
88
|
+
|
|
89
|
+
### Changed
|
|
90
|
+
- Primary API now uses keyword arguments (`scores:`, `values:`, etc.) for clarity and flexibility
|
|
91
|
+
- Refactored common validation logic into base Builder class
|
|
92
|
+
- Improved test suite with Minitest specs syntax
|
|
93
|
+
- Enhanced README with better organization and forward references
|
|
94
|
+
- Renamed `num_scores` parameter to `max_score` for better clarity in custom scoring functions
|
|
95
|
+
- Automatic corner radius clamping to valid range
|
|
96
|
+
|
|
97
|
+
### Deprecated
|
|
98
|
+
- `HeatmapBuilder.generate_calendar(scores, options)` - use `HeatmapBuilder.build_calendar(scores: scores, **options)` instead
|
|
99
|
+
- Old API still works with deprecation warnings for backward compatibility
|
|
100
|
+
|
|
10
101
|
## [0.1.0] - 2025-09-19
|
|
11
102
|
|
|
103
|
+
Initial release with core heatmap visualization capabilities.
|
|
104
|
+
|
|
12
105
|
### Added
|
|
13
|
-
- Initial release of HeatmapBuilder gem
|
|
14
|
-
- Linear heatmap generation with `HeatmapBuilder.generate()`
|
|
15
106
|
- Calendar heatmap generation with `HeatmapBuilder.generate_calendar()`
|
|
16
107
|
- GitHub-style color schemes and styling
|
|
17
108
|
- Customizable cell size, spacing, colors, and fonts
|
|
18
109
|
- Support for custom start of week (Monday/Sunday)
|
|
19
110
|
- SVG output format for perfect scaling
|
|
20
111
|
|
|
21
|
-
[Unreleased]: https://github.com/dreikanter/heatmap-builder/compare/v0.
|
|
112
|
+
[Unreleased]: https://github.com/dreikanter/heatmap-builder/compare/v0.4.3...HEAD
|
|
113
|
+
[0.4.3]: https://github.com/dreikanter/heatmap-builder/compare/v0.4.2...v0.4.3
|
|
114
|
+
[0.4.2]: https://github.com/dreikanter/heatmap-builder/compare/v0.4.1...v0.4.2
|
|
115
|
+
[0.4.1]: https://github.com/dreikanter/heatmap-builder/compare/v0.4.0...v0.4.1
|
|
116
|
+
[0.4.0]: https://github.com/dreikanter/heatmap-builder/compare/v0.3.1...v0.4.0
|
|
117
|
+
[0.3.1]: https://github.com/dreikanter/heatmap-builder/compare/v0.3.0...v0.3.1
|
|
118
|
+
[0.3.0]: https://github.com/dreikanter/heatmap-builder/compare/v0.2.0...v0.3.0
|
|
119
|
+
[0.2.0]: https://github.com/dreikanter/heatmap-builder/compare/v0.1.0...v0.2.0
|
|
22
120
|
[0.1.0]: https://github.com/dreikanter/heatmap-builder/releases/tag/v0.1.0
|
data/Gemfile.lock
CHANGED
|
@@ -1,70 +1,81 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
heatmap-builder (0.
|
|
4
|
+
heatmap-builder (0.4.3)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
9
|
ast (2.4.3)
|
|
10
|
-
|
|
10
|
+
docile (1.4.1)
|
|
11
|
+
drb (2.2.3)
|
|
12
|
+
json (2.19.9)
|
|
11
13
|
language_server-protocol (3.17.0.5)
|
|
12
14
|
lint_roller (1.1.0)
|
|
13
|
-
minitest (
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
minitest (6.0.6)
|
|
16
|
+
drb (~> 2.0)
|
|
17
|
+
prism (~> 1.5)
|
|
18
|
+
parallel (2.1.0)
|
|
19
|
+
parser (3.3.11.1)
|
|
16
20
|
ast (~> 2.4.1)
|
|
17
21
|
racc
|
|
18
|
-
prism (1.
|
|
22
|
+
prism (1.9.0)
|
|
19
23
|
racc (1.8.1)
|
|
20
24
|
rainbow (3.1.1)
|
|
21
|
-
rake (13.
|
|
22
|
-
regexp_parser (2.
|
|
23
|
-
rubocop (1.
|
|
25
|
+
rake (13.4.2)
|
|
26
|
+
regexp_parser (2.12.0)
|
|
27
|
+
rubocop (1.87.0)
|
|
24
28
|
json (~> 2.3)
|
|
25
29
|
language_server-protocol (~> 3.17.0.2)
|
|
26
30
|
lint_roller (~> 1.1.0)
|
|
27
|
-
parallel (
|
|
31
|
+
parallel (>= 1.10)
|
|
28
32
|
parser (>= 3.3.0.2)
|
|
29
33
|
rainbow (>= 2.2.2, < 4.0)
|
|
30
34
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
31
|
-
rubocop-ast (>= 1.
|
|
35
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
32
36
|
ruby-progressbar (~> 1.7)
|
|
33
37
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
34
|
-
rubocop-ast (1.
|
|
38
|
+
rubocop-ast (1.49.1)
|
|
35
39
|
parser (>= 3.3.7.2)
|
|
36
|
-
prism (~> 1.
|
|
37
|
-
rubocop-performance (1.
|
|
40
|
+
prism (~> 1.7)
|
|
41
|
+
rubocop-performance (1.26.1)
|
|
38
42
|
lint_roller (~> 1.1)
|
|
39
43
|
rubocop (>= 1.75.0, < 2.0)
|
|
40
|
-
rubocop-ast (>= 1.
|
|
44
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
41
45
|
ruby-progressbar (1.13.0)
|
|
42
|
-
|
|
46
|
+
simplecov (0.22.0)
|
|
47
|
+
docile (~> 1.1)
|
|
48
|
+
simplecov-html (~> 0.11)
|
|
49
|
+
simplecov_json_formatter (~> 0.1)
|
|
50
|
+
simplecov-html (0.13.2)
|
|
51
|
+
simplecov_json_formatter (0.1.4)
|
|
52
|
+
standard (1.55.0)
|
|
43
53
|
language_server-protocol (~> 3.17.0.2)
|
|
44
54
|
lint_roller (~> 1.0)
|
|
45
|
-
rubocop (~> 1.
|
|
55
|
+
rubocop (~> 1.87.0)
|
|
46
56
|
standard-custom (~> 1.0.0)
|
|
47
57
|
standard-performance (~> 1.8)
|
|
48
58
|
standard-custom (1.0.2)
|
|
49
59
|
lint_roller (~> 1.0)
|
|
50
60
|
rubocop (~> 1.50)
|
|
51
|
-
standard-performance (1.
|
|
61
|
+
standard-performance (1.9.0)
|
|
52
62
|
lint_roller (~> 1.1)
|
|
53
|
-
rubocop-performance (~> 1.
|
|
63
|
+
rubocop-performance (~> 1.26.0)
|
|
54
64
|
unicode-display_width (3.2.0)
|
|
55
65
|
unicode-emoji (~> 4.1)
|
|
56
|
-
unicode-emoji (4.
|
|
66
|
+
unicode-emoji (4.2.0)
|
|
57
67
|
|
|
58
68
|
PLATFORMS
|
|
59
69
|
arm64-darwin-24
|
|
60
70
|
ruby
|
|
61
71
|
|
|
62
72
|
DEPENDENCIES
|
|
63
|
-
bundler (
|
|
73
|
+
bundler (>= 2.0)
|
|
64
74
|
heatmap-builder!
|
|
65
|
-
minitest (
|
|
66
|
-
rake (
|
|
75
|
+
minitest (>= 5.0)
|
|
76
|
+
rake (>= 13.0)
|
|
77
|
+
simplecov (~> 0.22)
|
|
67
78
|
standard (~> 1.0)
|
|
68
79
|
|
|
69
80
|
BUNDLED WITH
|
|
70
|
-
|
|
81
|
+
4.0.9
|