Data Works
flotCanvasText
Open source · 2010–12
About this project
This simple Flot plugin “draws” text (tick labels, data point values, legends, etc.) directly on Flot's canvas context. Flot itself is an amazing graph package written on top of jQuery.
Why would someone need this? Back at release 0.6, Flot's tick labels and legends were HTML divs layered over the chart, not drawn on the canvas. So you couldn't use canvas.toDataURL("image/png") to export the complete graph (lines + text) as an image. I needed to remove every div overlay, so I wrote this plugin.
The demos below are based on the original Flot examples, with a thing or two changed to highlight the problem. Each one also uses Jacob Seidelin's canvas2image library to show how easy it is to turn the canvas into an image.
