How can I add text as a jqplot canvasOverlay?
canvas, javascript, jqplot, jquery
Solution
Found a solution, posted by Chris Leonello the jqplot author to the google groups in 2010: https://groups.google.com/forum/?fromgroups=#!topic/jqplot-users/GDZW4BsDMiA
Chris' solution is to place this line after the plot1 code, and it works well for me.
`mytitle = $('<div class="my-jqplot-title" style="position:absolute;text-align:center;padding-top: 15px;width:100%">My Custom Chart Title</div>').insertAfter('.jqplot-grid-canvas');`
Problem
I'd like to overlay a label on a jqplot chart. The label should consist of text or ideally, any markup. I've examined the documentation and examples, and can't find examples of arbitrary labels in the main jqplot chart area. Related features of jqplot: canvasOverlay is used to draw arbitrary lines on the chart. Additionally, the 'title' label exists, but sits outside the chart. It seems like this should be simple. Some options: - Change jqplot CSS for the main label to move it inside the chart. - New label in jqplot. - Problem scope is really outside jqplot, and proper solution is generic using Canvas. Thanks in advance!