Annotating Graphs cleanly



I am working on an application where I need to annotate graphs I
generate in such a way that each point is labelled with a small bit of

For instance, my point may be drawn as (12, 100), but I need a label
on that point thats a brief line of text, such as “New membership mail

I’ve looked at a few libraries, like Gruff, but they do not do this
for me, so I am working on it myself using RMagick.

My question, before I get too deep into codin’:
Anyone know of a library that does that? The big deal part is getting
the text on the image, and not overlapping. If you have 2 points
about the same level, the text1 may overlap on text2.

I am hoping someone has seen a library, or algorithm that can help jog
the labels around so they don’t overlap.