From 87c290944ab32022709bdd9e72bc2733745bc2a3 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 21 Nov 2022 20:40:41 +0100 Subject: [PATCH] logarithmic repeat markers multiply by 10 Quick solution to make it at least somewhat useful. --- barcat | 8 ++++---- t/t2258-repeat_markers_--mark=:/1.out | 2 +- t/t2259-log_axis.in | 1 + t/t2259-log_axis_-e_--markers=+/1.out | 7 +++++++ 4 files changed, 13 insertions(+), 5 deletions(-) create mode 120000 t/t2259-log_axis.in create mode 100644 t/t2259-log_axis_-e_--markers=+/1.out diff --git a/barcat b/barcat index 1ffdeda..431ed40 100755 --- a/barcat +++ b/barcat @@ -263,10 +263,10 @@ if ($opt{markers} and $size > 0) { return $func; } elsif ($func =~ /\A\/($float)\z/) { - my @range = $1; - #TODO log - for (my $next = $1; $next < $maxval; $next += $range[0]) { - push @range, $next; + my @range = my $multiple = my $next = $1; + while ($next < $maxval) { + $multiple *= 10 if $opt{log}; + push @range, $next += $multiple; } return @range; } diff --git a/t/t2258-repeat_markers_--mark=:/1.out b/t/t2258-repeat_markers_--mark=:/1.out index 369ae19..c23950d 100644 --- a/t/t2258-repeat_markers_--mark=:/1.out +++ b/t/t2258-repeat_markers_--mark=:/1.out @@ -6,4 +6,4 @@ 6 ---:---:---:---:----:---: 7 ---:---:---:---:----:---:---:- 8 ---:---:---:---:----:---:---:---:- -9 ---:---:---:---:----:---:---:---:----- +9 ---:---:---:---:----:---:---:---:----: diff --git a/t/t2259-log_axis.in b/t/t2259-log_axis.in new file mode 120000 index 0000000..655505d --- /dev/null +++ b/t/t2259-log_axis.in @@ -0,0 +1 @@ +t1260-powers_of_ten.in \ No newline at end of file diff --git a/t/t2259-log_axis_-e_--markers=+/1.out b/t/t2259-log_axis_-e_--markers=+/1.out new file mode 100644 index 0000000..4cd6f7c --- /dev/null +++ b/t/t2259-log_axis_-e_--markers=+/1.out @@ -0,0 +1,7 @@ + 1 + 10 ----+- + 100 ----+-----+ + 1000 ----+-----+----+- + 1e4 ----+-----+----+-----+ +100000 ----+-----+----+-----+----+- + 1e6 ----+-----+----+-----+----+-----+ -- 2.30.0