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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:00:27+00:00 2026-06-12T07:00:27+00:00

Random Data var data = [53245]; var data2 = [28479, 234234]; var data3 =

  • 0

Random Data

var data = [53245];
  var data2 = [28479, 234234];
  var data3 = [19697];
  var data4 = [41123,12313];

Width & Height of canvas

  var w = 960,
      h = 500,
      r = Math.min(w, h) / 2,
      donut = d3.layout.pie().sort(null),

Here is where i decide how big I wish a arc to be

arc = d3.svg.arc().innerRadius(r - 100).outerRadius(r - 20).startAngle(-2).endAngle(-1.34),
arc2 = d3.svg.arc().innerRadius(r - 100).outerRadius(r - 20).startAngle(-1.34).endAngle(-0.68),
arc3 = d3.svg.arc().innerRadius(r - 100).outerRadius(r - 20).startAngle(-0.68).endAngle(-0.02),
arc4 = d3.svg.arc().innerRadius(r - 100).outerRadius(r - 20).startAngle(-0.02).endAngle(0.64), 
arc5 = d3.svg.arc().innerRadius(r - 100).outerRadius(r - 20).startAngle(0.64).endAngle(1.3),
arc6 = d3.svg.arc().innerRadius(r - 100).outerRadius(r - 20).startAngle(1.3).endAngle(1.96),

I have tried using transform, but my shape sits upside down. I would like it to be an arc not a U shape.

var svg = d3.select("body").append("svg:svg")
    .append("svg:g")
      .attr("transform", "translate(700,400) scale(1, -1)");

The paths for color etc

  var arcs = svg.selectAll("path")
      .data(donut(data))
         .enter().append("svg:path")
            .attr("fill", function(d, i) { return 'blue'; })
            .attr("d", arc)
      .data(donut(data2))
          .enter().append("svg:path")
              .attr("fill", function(d, i) { return 'green'; })
              .attr("d", arc2)
      .data(donut(data3))
          .enter().append("svg:path")
              .attr("fill", function(d, i) { return 'pink'; })
              .attr("d", arc3)
      .data(donut(data4))
          .enter().append("svg:path")
              .attr("fill", function(d, i) { return 'black'; })
              .attr("d", arc4)

     .data(donut(data4))
          .enter().append("svg:path")
            .attr("fill", function(d,i) {return 'yellow';})
            .attr("d",arc5)

     .data(donut(data4))
          .enter().append("svg:path")
            .attr("fill", function(d,i) {return 'orange';})
            .attr("d",arc6)
  • 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-12T07:00:29+00:00Added an answer on June 12, 2026 at 7:00 am

    I’ve solved it myself:

    .attr("transform", "translate(700,450) rotate(180) scale(-1, -1)")
    

    Simply added rotate & changed the scale 🙂

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

Sidebar

Related Questions

I have a Populater class for populating a database with random data. I would
I have a rake task to seed an application with random data using the
I've got about 25 tables that I'd like to update with random data that's
I'm using the following code to pull random post data onto the sidebar of
<div class=xxx>Number is {1|2|3|4}, and {one|two|three|four}</div> <div class=yyy></div> ... var data = $(.xxx).text(); $(.yyy).html(data);
I'm using the following code to create divs with random products. The JSON data
I'm using a CvNormalBayesClassifier. I'm training it with some random data, like in the
I'm practicing the data visualization library d3.js, and I am using a random data
I have data in format: Randomtext1 (random2,random4) Randomtext2 (ran dom) Randomtext3 Randomtext4 (random5,random7,random8) So
Random question, sorry if not appropriate for stackoverflow, but I didn't think it would

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.