Doesn't sound like you have to write a script, but instead a program where you can output this information graphically as you've said.
Here's one place where a general google found one copy of the source for the df command, but who knows if it is official or a modified one.
Apparently is it part of the coreutils, which you can get from the GNU Project.
So you may want to grab one of the tar.bz2 or other archive files and see if the source is there. My point is that you can attain what df does in program logic, and then find a way to make that visual via a graphical program like Qt.