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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:15:12+00:00 2026-06-08T20:15:12+00:00

In the sunburst , how can I make code select a root arc, just

  • 0

In the sunburst, how can I make code select a root arc, just after all arcs was generated?

For example, in the code:

var first_arc = ""
.json("../data/flare.json", function(json) {
   var path = vis.data([json]).selectAll("path")
       .data(partition.nodes)
     .enter().append("path")
       .attr("display", function(d) { return d.depth ? null : "none"; })
       .attr("d", arc)
       .attr("t_name", function(d) {return d.name})
       .style("fill-rule", "evenodd")
       .on("click", function(d)...

it would be passed as “d” to the “function” on click on the middle arc.

(its data goes first in the json file)

Update 1: Changing the code like so…

.style("fill-rule", function(d) {
   if (first_arc == "") first_arc = d; return "evenodd"})

…solved the problem, it returns object:

name: "flare"
children: Array[10]
...

but this solution doesn’t look right and isn’t general.

Update 2: I tried several selects, for example:

first_arc = d3.select("[name='flare']")

it usually returns array:

0: null
length: 1
parentNode: HTMLHtmlElement
__proto__: Array[0]

or “undefined”

Update 3:

first_arc = d3.select("[t_name='flare']")

returns array of size 1 with children:

0: SVGPathElement
   __data__: Object

, where __data__ is the object I’m after, but I can’t manage to select it.

  • 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-08T20:15:13+00:00Added an answer on June 8, 2026 at 8:15 pm

    The root node is the one with a “depth” attribute set to 0. So you can say:

    d3.selectAll("path").filter(function(d) { return d.depth === 0; })
    

    Your attempts above weren’t working because D3 uses CSS3 to select elements. So you can only use d3.select and d3.selectAll with CSS3 selectors i.e. you can’t access the data bound to each element this way. The way to filter on the bound data is to use selection.filter.

    D3 selections are literally an array of elements, see the “Operating on Selections” section.

    Lastly, you can get the bound __data__ property for an element using selection.datum().

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

Sidebar

Related Questions

I would like to update my current SB2 theme Sunburst so that the current
I have had problems getting a paster generated theme product to work in my
This is a general question but motivated by an example. The general question is:
I'm pretty sure this isn't possible, but just want to double check. Obviously the
I'm trying out the python Solr interface Sunburnt , and I've come across a
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { if ([[touch view] tag] == 1000) { tap=YES;
I'm new to ASP.NET but have quite a few successful test pages going now
I am using Sunburnt Python Api for Solr Search. I am using highlighted search
What's the best way to implement sunburnt's highlight response into an application (django based,
i'm facing a design problem within my project. PROBLEM i need to query solr

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.