aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-10 20:36:05 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-10 20:36:05 -0400
commit437b5a8e1a256d29ecfdaf25b55bcc3ecaeb9b5e (patch)
tree4777a2bcb21896dac1946fdb0f2bc0071448347c /GradeBook_lib.tcl
parent3474a52179d3fd1f1cd6d75fdc781b441840aec3 (diff)
downloadGradeBook-437b5a8e1a256d29ecfdaf25b55bcc3ecaeb9b5e.tar.gz
GradeBook-437b5a8e1a256d29ecfdaf25b55bcc3ecaeb9b5e.zip
uniform data is plotted as mid size blocks
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl5
1 files changed, 3 insertions, 2 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 000bdfe..58d2b03 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -2299,11 +2299,12 @@ proc data2txtPlot { data } {
set maxVal [::math::statistics::max $data ]
set minVal [::math::statistics::min $data ]
set diffVal [expr {$maxVal-$minVal}]
+ set chars {▁ ▂ ▃ ▄ ▅ ▆ ▇ █}; # 8 bars
if { $diffVal == 0 } {
set diffVal 1
+ set chars {▄}; # if all values are the same use mid bar
}
- set chars {▁ ▂ ▃ ▄ ▅ ▆ ▇ █}; # 8 bars
- set barsNum 8;
+ set barsNum [llength $chars];
foreach x $data {
# funky 1.1 are needed to convert it to floats
set cnt [expr { round((1.0*$x-$minVal)/(1.1*$diffVal)*(1.1*($barsNum-1.0))) }]