From a6b4aac417e519af666f52210e3176321953e639 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 6 Nov 2022 15:04:05 +0100 Subject: [PATCH] full distribution over sparkline indicators No unexpected min/max exceptions. --- barcat | 14 ++++------- t/t2100-sparkwave_--spark.out | 2 +- t/t2103-spark-lines_--spark_-w9.out | 24 +++++++++---------- t/t2105-spark_ascii_-a_--spark.out | 2 +- ...nicode_--spark=-\302\267\342\200\242O.out" | 2 +- ...ned_--spark=012345_-cs_--maxval=1_-L17.out | 2 +- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/barcat b/barcat index 095ee93..077bae0 100755 --- a/barcat +++ b/barcat @@ -55,7 +55,7 @@ GetOptions(\%opt, }, 'spark:s' => sub { $opt{spark} = [split //, - $_[1] || ($opt{ascii} ? ' ..oOO' : ' ▁▂▃▄▅▆▇█') + $_[1] || ($opt{ascii} ? ' .oO' : ' ▁▂▃▄▅▆▇█') ]; }, 'palette=s' => sub { @@ -285,10 +285,9 @@ while ($nr <= $limit) { say '' if $opt{width} and $nr and $nr % $opt{width} == 0; print color($color), $opt{spark}->[ !$val || !$#{$opt{spark}} ? 0 : # blank - $val == $order[0] ? -1 : # max - $val == $order[-1] ? 1 : # min - $#{$opt{spark}} < 3 ? 1 : - $rel * ($#{$opt{spark}} - 3) + 2.5 + $#{$opt{spark}} < 2 ? 1 : + $val >= $order[0] ? -1 : + $rel * ($#{$opt{spark}} - 1e-14) + 1 ]; next; } @@ -532,12 +531,9 @@ or I and I for 256-color variants. Replace lines by I, single characters corresponding to input values. -A specified sequence of unicode characters will be used for Of a specified sequence of unicode characters, the first one will be used for non-values, -the last one for the maximum, -the second (if any) for the minimum, -and any remaining will be distributed over the range of values. +the remainder will be distributed over the range of values. Unspecified, block fill glyphs U+2581-2588 will be used. =item -s, --stat diff --git a/t/t2100-sparkwave_--spark.out b/t/t2100-sparkwave_--spark.out index 67f4951..70f8cf1 100644 --- a/t/t2100-sparkwave_--spark.out +++ b/t/t2100-sparkwave_--spark.out @@ -1 +1 @@ -▇▇▇█▇▇▇▇▇▆▆▆▆▅▅▅▄▄▄▃▃▃▃▂▂▂▂▂▁▂▂▂▂▂▃▃▃▃▄▄▄▅▅▅▆▆▆▆▆▇▇▇▇▇▇▇▇▇▇▆▆▆▆▅▅▅▄▄▄▄▃▃▃▃▂▂▂▂▂▂▂▂▂▂▃▃▃▃▄▄▄▅▅▅▅▆▆▆▆▇ +█████████▇▇▇▆▆▅▅▄▄▃▃▂▂▂▁▁▁▁▁▁▁▁▁▁▁▂▂▂▃▃▄▄▅▅▆▆▇▇▇████████████▇▇▆▆▅▅▄▄▃▃▃▂▂▁▁▁▁▁▁▁▁▁▁▁▁▂▂▃▃▄▄▅▅▆▆▆▇▇██ diff --git a/t/t2103-spark-lines_--spark_-w9.out b/t/t2103-spark-lines_--spark_-w9.out index cde9902..01ea973 100644 --- a/t/t2103-spark-lines_--spark_-w9.out +++ b/t/t2103-spark-lines_--spark_-w9.out @@ -1,12 +1,12 @@ -▇▇▇█▇▇▇▇▇ -▆▆▆▆▅▅▅▄▄ -▄▃▃▃▃▂▂▂▂ -▂▁▂▂▂▂▂▃▃ -▃▃▄▄▄▅▅▅▆ -▆▆▆▆▇▇▇▇▇ -▇▇▇▇▇▆▆▆▆ -▅▅▅▄▄▄▄▃▃ -▃▃▂▂▂▂▂▂▂ -▂▂▂▃▃▃▃▄▄ -▄▅▅▅▅▆▆▆▆ -▇ +█████████ +▇▇▇▆▆▅▅▄▄ +▃▃▂▂▂▁▁▁▁ +▁▁▁▁▁▁▁▂▂ +▂▃▃▄▄▅▅▆▆ +▇▇▇██████ +██████▇▇▆ +▆▅▅▄▄▃▃▃▂ +▂▁▁▁▁▁▁▁▁ +▁▁▁▁▂▂▃▃▄ +▄▅▅▆▆▆▇▇█ +█ diff --git a/t/t2105-spark_ascii_-a_--spark.out b/t/t2105-spark_ascii_-a_--spark.out index eddad81..771c1a8 100644 --- a/t/t2105-spark_ascii_-a_--spark.out +++ b/t/t2105-spark_ascii_-a_--spark.out @@ -1 +1 @@ -OOOOOOOOOOOOoooooooo.................ooooooooOOOOOOOOOOOOOOOOOooooooooo................oooooooooOOOO +OOOOOOOOOOOOOoooooo...................ooooooOOOOOOOOOOOOOOOOOOOOooooo....................oooooOOOOOO diff --git "a/t/t2111-spark_unicode_--spark=-\302\267\342\200\242O.out" "b/t/t2111-spark_unicode_--spark=-\302\267\342\200\242O.out" index 54d2883..854d335 100644 --- "a/t/t2111-spark_unicode_--spark=-\302\267\342\200\242O.out" +++ "b/t/t2111-spark_unicode_--spark=-\302\267\342\200\242O.out" @@ -1 +1 @@ -·•••-••••••••O-••- +···•-•••••••OO-O·- diff --git a/t/t2180-spark_combined_--spark=012345_-cs_--maxval=1_-L17.out b/t/t2180-spark_combined_--spark=012345_-cs_--maxval=1_-L17.out index 85a1446..777e015 100644 --- a/t/t2180-spark_combined_--spark=012345_-cs_--maxval=1_-L17.out +++ b/t/t2180-spark_combined_--spark=012345_-cs_--maxval=1_-L17.out @@ -1,2 +1,2 @@ -12330443443445043 +11230444443455052 -7.459 of -7.459 total in 16 values over 18 lines (-3 min, -0.47 avg, 2 max) -- 2.30.0