termchart 0.1.1 → 0.1.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: 66ec55314930e7c2c54652b8acac00c757c5e707ce56d407150af1dc452b089f
4
- data.tar.gz: 4a70285ba3b7bf50b39cce857a54dbb05e913c070777e66e1f5247ac9a6b310a
3
+ metadata.gz: 61d7a54444a32d1b78ca78fc4d8b5d4e1c5c16b7e26a9f5a163066fd9ebc7831
4
+ data.tar.gz: e5c466192416619cf7e556c5f8ad7cae6dd84210e5f5a2acfc58b33bc5f3b350
5
5
  SHA512:
6
- metadata.gz: 6f48f4f24d481cde7647774a34992231bfabf8ae1839ff01967db03e428abb0c0179782ca3f7341accc36500cf15850376e736a43040c54d0636844dbb28f12a
7
- data.tar.gz: 3fd672278e764531694fa78abcb71d86756c3f159077a1ebab81a423ff0c74dcfb8d4ca8e76d033349913a4c457bb9fd3418400dc140d7b0b6d2d5babe8c777c
6
+ metadata.gz: 93b4a0c40d9dcc79d311040340714218d0d89c9215383bcab42de9b7c20b704870d3e394505753c17a2db978c08ca7c92cf724c4f2ed74202328bb03d0c989df
7
+ data.tar.gz: 5e5805164766efd3d04089ed36aaaba435cecbf2574c0b7d232e3c0cbc1e65cca8733dc66355f6d22cd4018fb58093ee491b4adc1e791cfa72d4d6a9c17c8336
@@ -25,8 +25,9 @@ module Termchart
25
25
  data_range = data_max - data_min
26
26
  data_range = 1.0 if data_range.zero?
27
27
 
28
- # Reserve space for Y-axis labels
29
- y_label_w = format_num(data_max).length + 1
28
+ # Reserve space for Y-axis labels (use widest of min/mid/max)
29
+ mid = data_min + data_range / 2.0
30
+ y_label_w = [format_num(data_max), format_num(data_min), format_num(mid)].map(&:length).max + 1
30
31
  chart_w = @width - y_label_w
31
32
  chart_w = 10 if chart_w < 10
32
33
  chart_h = @height
@@ -1,3 +1,3 @@
1
1
  module Termchart
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: termchart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-04 00:00:00.000000000 Z
11
+ date: 2026-03-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Render sparklines, line charts (braille), candlestick charts, and bar
14
14
  charts as plain strings with ANSI color codes. Zero dependencies, pure Ruby.