简体   繁体   English

悬停canvas元素时是否可以获得工具提示?

[英]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 实际上,该元素呈现如下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. 如果您刚刚开始,那么我建议您在此处使用Kineticjs链接,在这里您可以使用画布做很多有趣的事情,其中​​包括标签。请在此处查看本教程以获取带有动态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: 希望它使用jQuery或者帮助您可能需要一些额外的工作,你可以这样做 ,例如在这个例子中,我们像添加文字:

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 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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