Relative Content

Tag Archive for javascriptd3.js

how to pass parameters to an anonymous function that is also the parameter of another function in d3.js?

svg.selectAll(‘.node’) .filter(node => node.id.toLowerCase().includes(para_group)) .style(‘opacity’, 1) .attr(“r”, 10); this is from a d3.js-used file, as seen above, “node” is the parameter of an anonymous function which is the parameter of filter() function, does the selectAll() function automatically passes the result as a parameter to filter() function? javascript d3.js New contributor kawsar anwar is a new […]

d3.js how to keep focus on node, when collapsing and expanding

There is a dynamic hierarchy tree written by myself with d3.js library. When collapsing and expanding the nodes, the distance between the nodes is dynamically recalculated and the focus is shifted. This does not seem critical if you collapse or expand a node that has few descendants. But if there are many descendants, when you click, the distance changes and the node you clicked on moves to the side. Is there a way to keep the focus so that when you click, the mouse pointer does not move to the side, and the node is drawn relative to the position of the node that was clicked?

D3 Projection has black border, causes country fills to be impossible

I am currently trying to setup a D3 Map with PIXI. For some reason, when using d3.geoMercator with data from https://www.geoboundaries.org/. I get this border around my map:

When having all my countries outlined this is fine, but I am wanting to highlight countries in different colours. As soon as I try any form of fill it fills the entire screen.