Thank you! I'll try to use that snippet as a grounding for my own code. Thing is that I'm not really sure of what kind of data should the graphical representation contain, because when I start to play around with the idea so many different possibilities come to mind. But then again, that's for me to decide and tinker with :)
Yeah, sleep on it for a few days, it saves rewrites later when you realize there is a better way. But then again, you often don't see the need for a better way, until you jump into the code and start hacking.