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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:30:05+00:00 2026-06-12T00:30:05+00:00

I am using the the code found here: http://bl.ocks.org/1249394 for this tree diagram. How

  • 0

I am using the the code found here: http://bl.ocks.org/1249394 for this tree diagram.

How do I change the the size of the root node only? I want the root node to have a different size than all the child nodes. How do I do this?

  • 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-12T00:30:07+00:00Added an answer on June 12, 2026 at 12:30 am

    Basically you need a property that you can use to tell the nodes apart. Looks like there is an existing parent property that can be used to figure out when a node is the root. So you just need to change the append functions to modify the radius of the circle if the node has no parent (that is, it is the root).

    nodeEnter.append("svg:circle")
      .attr("r", function(d) { return !d.parent ? 8.5 : 4.5; })
      .style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; })
      .on("click", click);
    

    You can see a working example at http://bl.ocks.org/3767443.

    In general, if you want to modify particular nodes you can add a new property to nodes that you want to be different like this:

    {
        "name": "MAT",
        "root": true,
        "children": [
            { ... } ... 
        ]
    }
    

    You can then use this property to modify the node as it’s being appended (here I’m modifying the circle, but you can do the same for the text as it is added). Notice that instead of hard coding the size of the circle to 4.5, I’m now using the root property to make root nodes larger.

    nodeEnter.append("svg:circle")
        .attr("r", function(d) { return d.root ? 8 : 4.5; })
        .style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; })
        .class(function(d) { return d.root ? 'root-node' : 'normal-node'; })
        .on("click", click);
    

    If you also set the class like I did above, then you can use CSS to style your root node however you want:

    .root-node {
      cursor: pointer;
      fill: #fff;
      stroke: green;
      stroke-width: 3.5px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using this code for suspend process.i found it here http://www.codeproject.com/KB/threads/pausep.aspx BOOL SuspendResumeThreadList(DWORD
I'm using the source code found on this site here: http://webtint.net/tutorials/5-star-rating-system-in-php-mysql-and-jquery/comment-page-1/#comment-2562 A fantastic resource,
I am looking at an example found here: http://perlmeme.org/tutorials/sort_function.html And it gives this code
I'm attempting to following the tutorials found here: http://www.ifadey.com/2010/06/crud-using-jquery-and-codeigniter/ My code is updated to
I'm using code I found for a jquery style sheet switcher. From here: http://www.cssnewbie.com/simple-jquery-stylesheet-switcher/
I'm using an HTML sanitizing whitelist code found here: http://refactormycode.com/codes/333-sanitize-html I needed to add
I created a few mediawiki custom tags, using the guide found here http://www.mediawiki.org/wiki/Manual:Tag_extensions I
I'm using the code found here http://blog.blackwhale.at/?p=336 to create a custom activityIndicator in the
I'm using the WindowsMedia library found here: http://www.ernzo.com/soundstudio.aspx The sample code had the ability
I'm using jquery and the jquery-json plugin found here: http://code.google.com/p/jquery-json/ I've checked at http://jsonlint.com/

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.