histogram: Partly painted insides work, too.
This commit is contained in:
parent
a159f9acec
commit
0ccf2cef20
|
@ -548,16 +548,20 @@ sub bar_string {
|
||||||
my $white = $width-int($l);
|
my $white = $width-int($l);
|
||||||
# $front="F".$front;
|
# $front="F".$front;
|
||||||
# $end=$end."E";
|
# $end=$end."E";
|
||||||
|
my $rev = '[7m';
|
||||||
|
my $reset = '[0m';
|
||||||
if(length $front < $black) {
|
if(length $front < $black) {
|
||||||
# Paint $front reverse
|
# Paint $front reverse
|
||||||
$black -= length $front;
|
$black -= length $front;
|
||||||
$width -= length $front;
|
$width -= length $front;
|
||||||
|
$front = $rev . $front . $reset;
|
||||||
} else {
|
} else {
|
||||||
# label overlaps white
|
# label overlaps white
|
||||||
# TODO reverse the first $black chars
|
# TODO reverse the first $black chars
|
||||||
|
$white = $width - length $front;
|
||||||
|
$front = $rev . substr($front,0,$black). $reset.substr($front,$black);
|
||||||
$black = 0;
|
$black = 0;
|
||||||
$l = 0;
|
$l = 0;
|
||||||
$white = $width - length $front;
|
|
||||||
}
|
}
|
||||||
if(length $end < $white) {
|
if(length $end < $white) {
|
||||||
# Just append $end
|
# Just append $end
|
||||||
|
@ -566,9 +570,10 @@ sub bar_string {
|
||||||
} else {
|
} else {
|
||||||
# label overlaps black
|
# label overlaps black
|
||||||
# TODO reverse the first length($end)-$white chars
|
# TODO reverse the first length($end)-$white chars
|
||||||
|
$black = $width - (length($end)-$white);
|
||||||
|
$end = $rev . substr($end,0,length($end)-$white). $reset.substr($end,length($end)-$white);
|
||||||
$white = 0;
|
$white = 0;
|
||||||
$l = 0.9;
|
$l = 0.9;
|
||||||
$black = $width - length $end;
|
|
||||||
}
|
}
|
||||||
my $middle = ($eight[0] x $black). ($eight[7-(int($l*8))%8]). (" "x$white);
|
my $middle = ($eight[0] x $black). ($eight[7-(int($l*8))%8]). (" "x$white);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue