Some preliminary work on graphing grades for students

Some preliminary work on graphing grades for students

by Stephen Edwards -
Number of replies: 16

At SIGCSE, I ran into D.I. von Briesen and he suggested I post some info about some graphs we've been generating on our local Moodle installation. This work was originally done by some students for a class project, and it is still a bit rough, but I'd be happy to contribute it. We also have a paper in the ASEE conference this summer on our experiences with students using Moodle with these graphs enabled across an entire semester.

Anyway, what we've done is added some simple graphs that are visible to students or course staff on each gradebook page. The graphs make use of the categories and weights you've set up in your gradebook, if you are using those features. On the main grades page that students see a graph like this (a screenshot from live course data, with the student's info blocked out):

pixel-area1.png

This graph, which is sometimes called a pixel area graph, summarizes the student's performance on all the work graded so far. The height of each bar indicates the student's score, while the width of each bar indicates the weight for that assignment in the student's overall grade. If you mouse over a bar, you get a tooltip (the mouse pointer didn't show up in this cut-down screen capture):

pixel-area2.png

There is a dropdown list at the bottom of the graph so that student can select alternative views, and so that other graphical representations can be easily plugged into this extension to the gradebook. Right now, students can select a star graph if they wish:

star-graph.png

While the first graph is pure HTML, the star graph is rendered using GD. Each radial axis represents one category in the gradebook, so you'll get a different kind of polygon depending on how many categories you have. The student's overall performance across all assignments in that category is plotted as a distance from the origin. The left portion shows the student's performance, while the right one shows the class average. In this case, the student has performed better than others on the midterm, about average on the final, and worse on homework and program assignments.

When a student drills down into a specific category, they see a bar graph of their scores on all assignments in that category:

bar-graph.png

The bar graph is pretty straight-forward, and is just HTML. It shows the student's performance on each assignment, together with an indication of the class average on that assignment.

Instructors get to see the same graphs when using the gradebook. Usually, when looking at scores across the class, the graphs show the class average instead of "your" scores, but when you drill down to a particular student's information, instructors see the same version that the student would see when looking up their own grades.

We do have a student that is working on a line graph that shows the student's "grade trajectory" over time, together with a projection of future performance (based on a regression model) and the "envelope" of best possible and worst possible outcomes the student can achieve based on their current grades, but that one isn't ready yet.

If anyone is interested in making use of this code, I'll try to pull together some instructions and post the code here on the forum.

In reply to Stephen Edwards

Re: Some preliminary work on graphing grades for students

by Stephen Edwards -

OK, the attached zip file contains the additions we used in our grade/ directory in order to implement these graphs. This code is still very raw, but we're interested in contributing it to Moodle somehow and throwing it out here on the forum seemed like a easy way to get started down that path. If you find it useful, let me know.

Although we're running this live on our production moodle (and have been since last June), I haven't had anyone test out this attached zip, so take it with a grain of salt. Add the files to your grade/ directory. Then edit your grade/lib.php and use the lib.php.diffs file in the attached zip to add the code that causes the graphs to appear automatically on each gradebook page. There aren't a lot of changes to the lib.php file, and they are all just a line or two each.

Let us know if it works for you.

In reply to Stephen Edwards

回應: Re: Some preliminary work on graphing grades for students

by Chiu Charlie -
Thanks for the great work!

I tried the patch and it works great.  The only problem I had is that I am using unicode in doublebytes environment, Chinese chars specifically, and in the star graph the label of the category or the name of the grade showed incorrect as attached below.

Any idea that where I should change? I check the code there is no common problem in using htmlentities, looked like it is in the GD module?




Attachment gradevisual.php.png
In reply to Chiu Charlie

Re: 回應: Re: Some preliminary work on graphing grades for students

by Stephen Edwards -
The code just uses the PHP imageString() function to write the category label on the image (which then performs the GD operations necessary). See grade/gradevisual.php line 1703. This call also specifies the font to use, which is currently "3"--one of the built-in system fonts for GD. My guess is that either the selected system font doesn't support your characters, or that imageString() doesn't support unicode, or both. You might be able to fix this yourself by using imageLoadFont() and changing the font parameter in the imageString() call, or by switching from imageString() to an appropriate call to imageTtfText(). I haven't tried either, of course smile.
In reply to Chiu Charlie

Re: 回應: Re: Some preliminary work on graphing grades for students

by Nikhil Raje -

I am working as moodle admin in my college. I wanted an help from you regarding the gradebook graphs. If possible can you mail me the updated lib.php file and the procedure for implementing the gradebook graph. Plz its an request.
My mail Id: nikhilrraje@gmail.com
Thank You

In reply to Stephen Edwards

Re: Some preliminary work on graphing grades for students

by Urs Hunkler -
Picture of Core developers

Hi Stephen, these graphs look great.

Trying to apply the patch I get errors:

patching file lib.php
Hunk #2 succeeded at 1608 (offset -4 lines).
Hunk #3 succeeded at 1725 with fuzz 2 (offset -4 lines).
Hunk #4 FAILED at 1789.
Hunk #5 FAILED at 1876.
Hunk #6 FAILED at 1905.
Hunk #7 FAILED at 2141.

I am using the latest lib.php,v 1.16.2.13 2006/02/13 01:36:26 toyomoyo. Against which version did you create the patch?

Thanks for your help
Urs

In reply to Urs Hunkler

Re: Some preliminary work on graphing grades for students

by Stephen Edwards -
The patch was generated against v1.16.2.12 of grade/lib.php (2005/12/07). I'd suggest applying the patch manually if you are using a newer version. The additions are relatively straightforward.
In reply to Stephen Edwards

Re: Some preliminary work on graphing grades for students

by Michael Penney -
Hi Stephen, this looks very interesting! If you could release the code with instructions I would be quite interested in looking at it.

Do you have any information on the performance implications of these graphs? Have you tried it with large courses (100+)?

Best
Michael
In reply to Michael Penney

Re: Some preliminary work on graphing grades for students

by Stephen Edwards -
> If you could release the code with instructions I would be quite
> interested in looking at it.

The code is attached in the 1st reply above. As for instructions, if you mean instructions for installing, they are pretty simple, and are also in the 1st reply above.

> Do you have any information on the performance implications of these graphs?

It basically has the same performance limitations as the existing gradebook code, where the limitations mostly derive from the API for retrieving scores from modules. IIRC, the gradebook code already retrieves all scores in the class (placing them in $grades_by_student) and then filters them down to just those visible to the student while calculating derived stats. The graphing code basically piggybacks on this same set of retrieved scores, and adds an extra pass over $grades_by_student. Of course, this same fetch gets performed every time another view of the gradebook is generated, so the cost is always there, no matter what subset of the data you are looking at. Just like the regular gradebook, for larger classes there can be a short pause before the table gets displayed. I haven't really noticed that the graphs slow things down any more than the gradebook without them, however.

> Have you tried it with large courses (100+)?

We have for courses 60-100 students, but not much larger than that. We haven't really had any complaints from either students or instructors about speed on grade viewing in this context, either. YMMV.

As the gradebook guru, if you know of a way to streamline the derived stats calculations, that would be great!
In reply to Michael Penney

Re: Some preliminary work on graphing grades for students

by Matt Campbell -
I just worked with the instructions and tried to integrate it with your gradebook plus mod - it works partially, but other aspects break.  If you're able to get this working with your gradebook mods, I know one person who would appreciate it!

Thanks,
Matt
In reply to Matt Campbell

Re: Some preliminary work on graphing grades for students

by Stephen Edwards -
We're using the stock gradebook instead of gradebookplus on our production moodle right now. I haven't looked into what needs to change to add this to gradebookplus.
In reply to Stephen Edwards

Re: Some preliminary work on graphing grades for students

by D.I. von Briesen -

Stephen:

It was great to meet you at BlueJ Day. I look forward to seeing more of what you guys are up to (you said something about a peer review module for assignments- and I know this has come up on other forums).

I really like the way you've got the width of the graphic showing the weighting. I typically have about 5 categories, weighted roughly at 20 pts each - but some of which include 30 + activities. I love the potential here and eager to see if we could take it further.

D.I.

In reply to D.I. von Briesen

Re: Some preliminary work on graphing grades for students

by Ger Tielemans -
Really, really nice: I will test it!

the stargraph could even be the base for a 3600 peerreview 
In reply to Ger Tielemans

Re: Some preliminary work on graphing grades for students

by D.I. von Briesen -
Oooooohhh!!. I really like that idea.

What would be even cooler is if the high score was on the center of the stargraph... so you were "targeting" the center...

Where is the peer module? I know VT has one...
d.i.
In reply to D.I. von Briesen

Re: Some preliminary work on graphing grades for students

by Chass Wingrove -

Hi All

Has anyone managed to get this working on 1.6?

When we apply the patch in only partially completes.

Is there a patch for version 1.6 we should be using?

Does anyone have a sucessfully edited LIB file we can place on our server instead? 

Any help gratefully received.

 

 

 

 

 

In reply to Stephen Edwards

Re: Some preliminary work on graphing grades for students

by Sarah Quantick -

This graphing packages looks excellent however whenever we try to install it it doesn't quite work. we have upgraded to 1.6  and use gradebook plus v2. The overall graph for each catergory can be shown how every more individual graphs give a blank screen. Another issue seems to be whenever the graphing package is installed we get a stream of errors produced is we try to eport from gradebook to excel.

In reply to Sarah Quantick

Re: Some preliminary work on graphing grades for students

by Tom Cox -
I just tried using this with 1.7. It kind of works but has some issues with labeling and the only graph option is bar graph. Has anyone made this work with 1.7? Is any new work being done on it? Any new info would be greatly appreciated. This feature may make or break Moodle as a choice for an LMS for my employer.