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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:02:49+00:00 2026-06-14T00:02:49+00:00

I’m trying to draw a chart with concentric circles where the radius will define

  • 0

I’m trying to draw a chart with concentric circles where the radius will define the distance between various points. I want the labels for all points at a particular distance to appear inside the respective shell. I’m using d3 to draw the graph. I have everything going except I can’t figure out how to ensure that the text renders nicely and aligned to a baseline with constant character width and character spacing. I have spent a whole day trying to figure it out and any help will be greatly appreciated.

Here’s the JSFiddle

here is the javascript code

var dataset = [{label:"Hello1", value:5},{label:"Hello2", value:10 {label:"Hello3",value:15},{label:"Hello4", value:20},{label:"Hello5", value:25}];

var arc = d3.svg.arc()
  .innerRadius(function(d,i){return i*35;})
  .outerRadius(function(d,i){return (i*35+30);})
  .startAngle(0)
  .endAngle(2 * Math.PI);

var svg = d3.select("body").append("svg")
  .attr("width", 960)
  .attr("height", 500)
  .selectAll("g")
  .data(dataset)
  .enter()
  .append("g")
  .attr("transform", "translate(480,250)");

var arcs = svg.append("path")
  .attr("fill","red")
  .attr("id", function(d,i){return "s"+i;})
  .attr("d",arc);

var thing = svg.append("g")
  .attr("id","thing")
  .style("fill","navy");

thing.append("text")
  .style("font-size",20)
  .attr("dy",function(d,i){return 20;})
  //.attr("alignment-baseline","middle")
  .append("textPath")
  .attr("textLength",function(d,i){return 90-i*5 ;})
  .attr("xlink:href",function(d,i){return "#s"+i;})
  .attr("startOffset",function(d,i){return 3/20;})
  .text(function(d){return d.label;})

​

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

    Do you mean something like this:

    http://jsfiddle.net/wcWUE/

    All I changed was:

    thing.append("text")
      .style("font-size",20)
      .append("textPath")
      .attr("textLength",function(d,i){return 90-i*5 ;})
      .attr("xlink:href",function(d,i){return "#s"+i;})
      .attr("startOffset",function(d,i){return 3/20;})
      .attr("dy","-1em")
      .text(function(d){return d.label;})
    

    Also I reversed the order of the rings so that occlusion was not a problem.

    I think you could make a separate collection of paths possibly just defined in a section to draw the text along.

    But I’m not sure if this result is what you are looking for?

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I want to show the soap response to UIWebview.. my soap response is, <p><img

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.