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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:38:01+00:00 2026-06-12T12:38:01+00:00

I am using the javascript library d3.js ( http://d3js.org/ ) to create canvas data

  • 0

I am using the javascript library d3.js (http://d3js.org/) to create canvas data visualizations. I’m trying to make an arc, but it’s not accepting the data parameters from my array. Does anyone know what I’m doing wrong? This is my code:

var chartConfig = { "canvasSize" : 800 }

var radius = chartConfig.canvasSize / 2;
var pi = Math.PI;

var vis = d3.select("#chart").append("svg")
    .attr("width", radius * 2)
    .attr("height", radius * 2)
    .append("g")
    .attr("transform", "translate(" + radius + "," + radius + ")");

var arcData = [
  {aS: 0, aE: 45,rI:radius/2,rO:radius}
];
var arc = vis.selectAll("arc").data(arcData).enter().append("arc");
arc.attr("innerRadius", function(d){d.rI}).attr("outerRadius",function(d){d.rO}).attr("class","arc");

function degToRad(degrees){
  return degrees * (pi/180);
}

enter image description here

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

    There is no arc element in SVG, you need to define the appropriate path element. Luckily there is a d3 helper function to do this.

    var arc = d3.svg.arc()
        .innerRadius(50)
        .outerRadius(70)
        .startAngle(45 * (Math.PI/180)) //converting from degs to radians
        .endAngle(3) //just radians
    
    vis.append("path")
        .attr("d", arc)
        .attr("transform", "translate(200,200)")
    

    Working example at http://jsfiddle.net/g0r9n090/;

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

Sidebar

Related Questions

I'm using this simple code: http://ejohn.org/blog/simple-javascript-inheritance/ Using this library, I made this simple class:
I'm using a javascript library to visualize rrdtool data and using rrdtool xport to
I want develop some web product with using javascript 3d library like three.js But
I am using a charting javascript library that expects its data in a specific
I’m generating multiple, random sized, circular elements using the Raphael JavaScript library but because
I'm using the PHP markdown library: http://michelf.com/projects/php-markdown/ and the Javascript markdown library: http://attacklab.net/showdown/ I
I'm using this Big Integer library for Javascript: http://www.leemon.com/crypto/BigInt.js and I need to be
I'm using a JavaScript library called phpjs The goal is to create functions that
I'm using JavaScript Places Library http://code.google.com/intl/en/apis/maps/documentation/javascript/places.html However, I can't find how to set the
I'm working on a HTML5 canvas game using a JavaScript library called Propulsionjs.com. The

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.