spm
spm

Reputation: 131

Display numeric values on hover within HTML canvas

No code this time around. I've successfully created some graphs in canvas which pull from a mySQL database.

My question is, how would I go about displaying the data values along the graph? Is it possible?

Not looking for anyone to write me code. Just a helpful tip in the right direction.

Thanks in advance.

Upvotes: 1

Views: 161

Answers (1)

Plynx
Plynx

Reputation: 11461

You can reference https://developer.mozilla.org/en-US/docs/Drawing_text_using_a_canvas to draw text on the canvas itself.

Or you can get the x,y positions and used position: absolute; DIVs or the like to overlay tooltip like information on top of the canvas.

Edit: Agreed on Shmiddty's comment, this is probably all more a job suited to SVG's strengths. See gRaphael for a vector graphing polyfill if you are interested.

Upvotes: 1

Related Questions