How to Overlay text on Chart March 18, 2010 03:47PM |
Registered: 14 years ago Posts: 2 |
While working around not being able to set the position of the text in the titles I came up with the following code. It simply draws text on the same canvas as JSCharts does. Not sure if it works with IE but it does work with Firefox, Chrome and Safari.
Charlie.
Charlie.
function overlayText() { var canvas = document.getElementById("JSChart_mycanvas" ); if (canvas.getContext) { var ctx = canvas.getContext("2d" ); ctx.strokeStyle = "rgb(0, 0, 0 )"; ctx.strokeText("Hello World. ", 10, 17 ,10 ); //strokeText("text to display", x pos, y pos, char width) } }[/code]
Sorry, you do not have permission to post/reply in this forum.