简体   繁体   中英

is it possible to get the tooltip while hovering the canvas element?

i have an canvas image for analog clock

i need to show the tool tip for second needle, hour needle and minute needle. But all of them are in single canvas image..

actually the element renders as like below in the html

<div id="circularframe" class="">
<div id="Analog clock">
<canvas role="presentation" width="500" height="360"></canvas>
</div>
</div>

Is it possible in canvas element...

if you have just started then i would recommend using Kineticjs link is here , where you can do lots of interesting stuff with canvas which includes labels too check this tutorial here for getting lables/tooltip on canvas with kinetic js. Hope it helps alternatively with Jquery you may have to some extra work , you can do something like this , for example in this example we add text like:

dots.push({
        x: getXPixel(data.values[i].X),
        y: getYPixel(data.values[i].Y),
        r: 4,
        rXr: 16,
        color: "red",
        tip: "#text" + (i + 1)
    });

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM