Need SVG to cause text box to pop up on mouse over

tekdoug
05-26-2005, 09:37 AM
Hi. Thanks in advance for any guidance you can provide. I'm looking for examples of SVG code to cause a test box to pop up when a user's mouse pointer hovers over an object. For example, when a user hovers her mouse pointer over a bar in a bar chart, the user sees a text box pop up with details about the data for that particular bar.

Anonymous
05-26-2005, 11:16 AM
You can
1) define your text box with visibility="hidden" as
<g id="tooltip" transform="translate(0 0)">
<rect ................
<text id="tooltip_data ...............
</g>

2) For your objects, define event ( for your bars by example)
<rect onmouseover="show_tooltip('some text',40,200)" onmouseout="hide_tooltip()" .... />

3) Define functions
function show_tooltip(data,x_pos,y_pos)
{
svgdoc.getElementById("tooltip").setAttribute("transform","translate(" + x_pos.toString() + " " + y_pos.toString() + ")")
svgdoc.getElementById("tooltip_data").firstChild.data = data
svgdoc.getElementById("tooltip").setAttribute("visibility","visible")
}

function hide_tooltip()
{
svgdoc.getElementById("tooltip").setAttribute("visibility","hidden")
}

Michel

tekdoug
05-26-2005, 08:16 PM
Thanks Michel for your prompt reply. I'll give it a try and see what happens.

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum