I have an svg/xml file that I'm loading into d3 using d3.xml(...)
This is the output of the SVG
I also have a small JSON dataset
const data = [{
"id": "polygon5256", //roof
"value": 39.5
},
{
"id": "polygon1628", //grass
"value": 3.93
},
{
"id": "polygon5254", //left wall
"value": 3.14
},
{
"id": "path5894", //door step
"value": 20.98
}
]
I'm trying to join the id's from the JSON dataset to the respective id's (polygons and paths) in the XML data. Do you know how I could also limit the selectable paths/polygons to only those that are in the JSON data? So only the available IDs will be affected by the mouse events?
Here is my jsfiddle
Any help would be much appreciated