Write labels in canvas for extraction via canvas.toDataURL()

36 views
Skip to first unread message

Tony E

unread,
Mar 12, 2015, 2:48:07 PM3/12/15
to flo...@googlegroups.com
I am finishing up an application that writes several charts using Flotr2. Now we're wanting to extract the images of those charts using the canvas.toDataURL() method but the labels aren't showing up. This is occurring because the tick labels are appearing as HTML positioned to look like they're in the canvas when they're actually not.

Does Flotr2 have any functionality to write the labels in the canvas instead? If not, it seems to know the positioning of the gridlines in the canvas, so if I could get those positions, it's possible I could add them to the canvas myself after the chart is painted. Any tips on grabbing those coordinates?

Other suggestions would be helpful... I have looked at a few ideas for taking a snapshot of an html element, but every tool I find seems to mention it may have issues positioning things exact. I also haven't found anything that definitively says it can snapshot a div that contains a canvas element among other elements.

Thanks!
Reply all
Reply to author
Forward
0 new messages