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 8458095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:59:08+00:00 2026-06-10T12:59:08+00:00

I am new to D3 and I am having a really hard time with

  • 0

I am new to D3 and I am having a really hard time with the Bubble Chart unless I use the exact example data :

  • https://github.com/mbostock/d3/blob/master/examples/bubble/bubble.js
  • https://github.com/mbostock/d3/blob/master/examples/data/flare.json

Specifically I am having trouble with

.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });

I am unable to run get this part of the code to work with other examples.

Here is a subset of the JSON data I am working with:

{
"name": 301,
"children": [
    {
        "resourceid": "11",
        "creator_uid": "301",
        "owner": "Tom",
        "name": "Omega",
        "created_time": "2012-03-07 20:07:11",
        "items": "4"
    },
    {
        "resourceid": "188",
        "creator_uid": "301",
        "owner": "Tom",
        "name": "Nexus",
        "created_time": "2012-03-31 00:04:56",
        "items": "14"
    }
  ]
}

I am able to set the radius to “items”, but I expect

.data(bubble.nodes(json)

to distribute the nodes, but I am getting errors that d.x is NULL. Given the sample data for the bubbles example, I’m not sure how the bubbles example is creating d.x and d.y.

Could someone please explain this in detail?

  • 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-10T12:59:09+00:00Added an answer on June 10, 2026 at 12:59 pm

    When using the Bubble Chart, the data must be flattened. In the example you linked, there’s a call to a function called “classes” which for every node, returns the class as a new object with the value property containing the size. (Your code above suggests you omitted this call).

    Later, the call to the function bubble.nodes uses the value property of each object created by the classes function (which were pushed into a single array) to compute the x and y (which in turn is used within the transform function). See the d3 docs for more info about the pack function. This same nodes function also computes the radius (as r) which is used later.

    It’s that call to nodes that determines the complete layout of the Bubble chart. The remainder of the code in the sample is all about constructing the necessary SVG elements such as a circle and text in the positions specified by the results computed by the nodes function.

    So you can’t directly pass the json data to the bubble.nodes function unless it meets specific requirements (such as having a value property).

    Here is a working example on jsfiddle.net.

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

Sidebar

Related Questions

I'm new to Simple.Data. But i'm having a really hard time finding out how
Im really having a hard time in matches constraints in grails, im pretty new
I am new to iPhone programming and am having a really hard time trying
I'm having a really hard time finding a good comprehensive source for Mechanize's documentation.
Having a really hard time trying to figure out a where in equivalent in
I'm having a really hard time with this one, EDIT: I'm putting this edit
I'm having a really hard time figuring out the scoping issue with the following
I am having a really hard time updating and deleting many to many relationships
I am new to EF and having a hard time understanding how the presentation
I'm new to Objective C and Cocoa - and I'm having a really hard

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.