score:0
I don't see a need to use D3 for your application. If you have point locations(x,y) for the various room walls, then create svg polygons. Each polygon has an onmouseover and onmouseout event. See the following basic example.
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<svg width=800 height=800>
<polygon name="My Living Room" onmouseover=showMyRoom(evt) onmouseout=hideMyRoom(evt) stroke-width=1 stroke=black fill=maroon points="100,100 100,300 400,300 400,100" />
</svg>
<div id=roomNameDiv style='box-shadow: 4px 4px 4px #888888;-webkit-box-shadow:2px 3px 4px #888888;padding:2px;position:absolute;top:0px;left:0px;visibility:hidden;background-color:linen;border: solid 1px black;border-radius:5px;'></div>
</body>
<script>
function showMyRoom(evt)
{
var room=evt.target
room.setAttribute("fill-opacity",".8")
var roomName=room.getAttribute("name")
var x=evt.clientX
var y=evt.clientY
roomNameDiv.style.left=x+20+"px"
roomNameDiv.style.top=y+30+"px"
roomNameDiv.innerHTML=roomName
roomNameDiv.style.visibility="visible"
}
function hideMyRoom(evt)
{
var room=evt.target
room.setAttribute("fill-opacity","1")
roomNameDiv.style.visibility="hidden"
}
</script>
</html>
Source: stackoverflow.com
Related Query
- how to create co-ordinates in svg for d3 js map
- How to Create a path in svg for d3 brush
- D3 map - How do I include SVG image files in JSON data to create custom location markers?
- how to use svg file for image source in D3
- how to create labels for data in donut chart using d3.js
- maximum number of svg elements for the browser in a map
- How to do smooth transition for map reprojection in d3 js
- In d3 for javascript, how do you create different elements for your data?
- D3.js: How to combine 2 datasets in order to create a map and show values on.mouseover?
- How to create a responsive map using d3
- How to add external svg file (by D3.js) to Leaflet map
- How to create SVG elements of different types based on data?
- For some reason, my D3 Map is displaying upside down - how can I flip it?
- D3: How to create slow transition of circle radii for nodes in force directed graphs?
- How do I create a minimap of an SVG using D3 v5 and show the current viewport dimensions?
- How can we create an onclick event for a d3 data map?
- In D3, how can I create multiple elements for each data element based on value in data?
- How to create a flow layout in SVG using D3.js?
- How create legend for bubble chart in d3? Legend not showing up
- How do I get the d3 svg points to stay in their correct position on the leaflet map when zooming?
- How do I create a multiline chart using d3js with json formatted for nvd3?
- How do I Bind Data from a .tsv to an SVG's paths using d3.js for a Choropleth Map
- How to create SVG shapes based on data?
- How to create responsive svg using d3.js
- How to fix unwanted circle on / break down of SVG path element for Sankey links with d3?
- I am trying to use multiple 2 arrays for binding data for svg circles but cannot figure out how
- How to set a CSS hover to a SVG map
- How to reset svg scaling and fit to screen for random but large maps/datasets with different orientations
- On a Google maps overlay, how do I create lines between svg elements in D3
- How so create complex SVG shapes using D3JS?
More Query from same tag
- Opening UI5 Quickview by non-SAPUI5 control
- Mouseevent div cover div on chart
- D3 can not get this.parentNode
- D3.js Error: <rect> attribute width: A negative value is not valid. (only happens in Chrome)
- CSS3 - Transform-origin not working on SVG element in d3.js
- How to use nested Python dictionaries and D3.js?
- Minor tweaks for histogram generated using d3
- How to place a text over a path d3.js
- Argument of type is not assignable to string
- How to use 'click, mouseover, mousedown' and so on in d3 v4
- Why doesn't d3.json send cookies with the request?
- D3.js: append path to a rect
- d3: tooltips on multi series line chart at each line when mouse hover event
- Lost flow chart lines after upgrading from 3.5.5 to 4.2.8
- How to set `side: right` of `textPath` in Chrome?
- D3.js - changing ordinal scales dynamically
- Standardised map projections per country or region for d3.js
- how to update text added in dimple.js stacked bar chart on data updation
- glowing sphere - d3 orthographic projection cant get css to work
- Property 'forEach' does not exist on type '{}'
- D3 get attributes from element
- Change Color of Links for Sankey Diagram in D3 / Javascript
- Legend in D3 circle pack diagram
- Treemap shape in React Native is not perfect (d3, react-native-svg)
- Building JSON dynamically in D3 javascript
- NVD3 - x axis labels fail
- How to export PNG within SVG
- Why is the vertical scrollbar always visible
- Why is my d3.tip not working?
- Why doesn't click event always fire?