aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-10 20:36:51 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-10 20:36:51 -0400
commit936a316fd1dc5ff1f7b0d72d028de10e431382eb (patch)
tree2fedb2ec17b0f2522729028b0b99721b8e0a5d18 /GradeBook_lib.tcl
parent437b5a8e1a256d29ecfdaf25b55bcc3ecaeb9b5e (diff)
downloadGradeBook-936a316fd1dc5ff1f7b0d72d028de10e431382eb.tar.gz
GradeBook-936a316fd1dc5ff1f7b0d72d028de10e431382eb.zip
some heuristic for histogram with a small number of bins
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl2
1 files changed, 2 insertions, 0 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 58d2b03..f459d9a 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -2330,6 +2330,8 @@ proc UpdateColumnGradesHistogram { columnname } {
set maxVal [::math::statistics::max $col_values ]; # fixme should it be _Max_Points_?
set minVal 0
set barsNum 10;
+ set uniqNum [llength [lsort -unique $col_values]]
+ set barsNum [expr {min($uniqNum, $barsNum)}]; # heuristic about number of bars/intervals
set limits [::math::statistics::minmax-histogram-limits $minVal $maxVal [incr barsNum]]
set limits [lrange $limits 1 end-1]; # shave first and last interval limits
set hist [::math::statistics::histogram $limits $col_values ]