From 936a316fd1dc5ff1f7b0d72d028de10e431382eb Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Thu, 10 May 2018 20:36:51 -0400 Subject: some heuristic for histogram with a small number of bins --- GradeBook_lib.tcl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'GradeBook_lib.tcl') 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 ] -- cgit v1.2.3