Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can elements overflow out of a HTML5 canvas?

I have an html canvas generated by javascript (chart.js library) but the chart is small and the tooltips are clipping to the canvas size. I want it to overflow out of the html canvas, is it possible?

I've tried setting overflow:visible but it didn't work.. Does HTML5 canvas work in a special way?

like image 862
sigmaxf Avatar asked Nov 01 '25 15:11

sigmaxf


2 Answers

If you can detect the object needing the tooltip, you could display the tooltip in HTML, outside (or overlapping) the canvas element, and layered on top.

like image 180
dhc Avatar answered Nov 04 '25 06:11

dhc


No, the default tooltips in chart.js are drawn on the canvas. They are not DOM elements. You have to make the canvas bigger, so that the tooltip fits, or implement your own tooltips.

like image 40
pablochan Avatar answered Nov 04 '25 06:11

pablochan