Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8258627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:36:29+00:00 2026-06-08T02:36:29+00:00

So I am trying to make my own version of this gorgeous visualization that

  • 0

So I am trying to make my own version of this gorgeous visualization that d3 has done:

http://mbostock.github.com/d3/talk/20111116/bundle.html

All I am doing is basically moving the entire chart to the left, and then trying to display the different relationships on right, so every time you hover over a name on the left, not only do you see the different types of connections change colors on the chart, you also see the names of these connections on the right.

The problem I am having is accessing the actual names of the connections. I am new to javascript and even newer to d3, and am having problems understanding how to access the actual names of these SVG elements Thus far I am doing it just in the console.log() by using two lines of code:

var targetTest = d3.selectAll("path.link.target-" + d.key);
console.log(targetTest);

In the console this will give me a log of all the SVG objects I want, but it gives me the full information for every one of the elements. Something like this:

0: SVGPathElement
__data__: Object
animatedNormalizedPathSegList: null
animatedPathSegList: SVGPathSegList
attributes: NamedNodeMap
baseURI: "http://localhost/mbostock-d3-    544addb/examples/bundle2/bundle.html"
childElementCount: 0
childNodes: NodeList[0]
className: SVGAnimatedString
clientHeight: 0
clientLeft: 0
clientTop: 0
clientWidth: 0
dataset: DOMStringMap
externalResourcesRequired: SVGAnimatedBoolean
farthestViewportElement: SVGSVGElement
firstChild: null
firstElementChild: null
id: ""
lastChild: null
lastElementChild: null
localName: "path"
namespaceURI: "http://www.w3.org/2000/svg"
nearestViewportElement: SVGSVGElement
nextElementSibling: SVGPathElement
nextSibling: SVGPathElement  
nodeName: "path"
nodeType: 1
nodeValue: null
normalizedPathSegList: null
offsetHeight: 0
__proto__: SVGPathElement
length: 1
parentNode: HTMLDocument
__proto__: Array[0]

The part of the data I am trying to access is within the data object, which contains three more objects.

source: Object
target: Object
__proto__: Object

within the source object, (which is what I am trying to access) there is a field named key, and this is the field I want to access

depth: 4
imports: Array[9]
key: "Interpolator"
name: "flare.animate.interpolate.Interpolator"
parent: Object
size: 8746
x: 40.62256809338521
y: 180

Basically I want to call a document.write, or similar $(#id).text() on this key, but I only seem to be able to access one element at a time, AKA I am using

var target = d3.selectAll("path.link.target-" + d.key);
var source = d3.selectAll("path.link.source-" + d.key);
var imports = source.property("__data__").target.key;
var exports = target.property("__data__").source.key;

but each of these will only give me one name, rather then a full list.
AKA when I hover over an element, even if it has multiple “imports” or “exports” the

console.log(imports)

will only give me 1 name at a time, even though I used selectAll.

Any help would be much appreciated! I’m sorry if the question is a bit convoluted, I tried to be as specific as possible, since it is a very specific question, but I may have gone into to much detail… if that is possible. Anyway thanks before hand!

Isaac

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:36:32+00:00Added an answer on June 8, 2026 at 2:36 am

    Use each on the source and target variables to get every value that they return instead of just the first value.

    var targets = d3.selectAll("path.link.target-" + d.key);
    var sources = d3.selectAll("path.link.source-" + d.key);
    var imports = [];
    var exports = [];
    targets.each(function(d) {
      imports.push(d["source"].key);
    });
    sources.each(function(d) {
      exports.push(d["target"].key);
    });
    console.log("Imports - " + imports);
    console.log("Exports - " + exports);
    

    Here is a JSFiddle showing it in action. I added the above code to the mouseover function since that is where the highlighting is done.

    D3 methods like attr and style use each behind the scenes so you don’t have to, but since you are using a custom function to access data you will need to use each.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make an ActivityGroup which has it's own interface, which should be
I'm trying to make my own version of UITableViewController in a UIViewController (for more
Im trying to make my own FormsAuthentication in an ASP.NET MVC 4 application and
So am trying to make my own openID login for my GAE app and
I am trying to make my own user control and have almost finished it,
I was trying to make my own class for currencies using longs, but apparently
i'm trying to make my own ExceptionFilter. Out of the box, ASP.NET MVC comes
I am trying to make my own Jabber bot but i have run into
I've been trying to make my own basic .obj (Wavefront) renderer using the OpenGL
I want to make my own Start Menu replacement and I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.