In our environement, roleids aren't just 1, 2, 3,4 etc and this breaks most of the pretty graphs:
Notice: Undefined offset: 41 in /var/www/moodle/course/report/stats/graph.php on line 122
Notice: Undefined index: in /var/www/moodle/lib/graphlib.php on line 447
Notice: Undefined index: in /var/www/moodle/lib/graphlib.php on line 1677
This is because the colours trying to set the roles as colours on the graph (which only go up to 30). We should remove the colouring of role by roleid, and instead just use some sort of incremental counter. (And accept we can't show more than 30 roles at once).