reset the map when new parameters are chosen

This commit is contained in:
Viktor Barzin 2025-06-18 19:12:00 +00:00
parent 7c70da4bed
commit ba4a95825b
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863

View file

@ -60,7 +60,7 @@ export function Map(
return () => {
mapRef.current.remove()
}
}, [])
}, [data])
function clone(d) {
@ -155,7 +155,10 @@ export function Map(
* @type {number}
*/
var svg_height = 300, svg_width = 70;
var svg = d3.select('#svg');
// clear svg before starting
d3.select('#svg').selectAll('*').remove();
// create a new SVG element
const svg = d3.select('#svg');
var defs = svg
.attr('height', svg_height)
.attr('width', svg_width);
@ -215,7 +218,6 @@ export function Map(
for (let property of properties) {
listingComponents.push(getPropertyComponent(property));
}
console.log(listingComponents.length)
return <ScrollArea className="rounded-md border">
<div className="overflow-y-auto h-[500px] w-[500px] scrollbar-thin scrollbar-thumb-rounded">