# D3.js areaRadial.angle() Method

Last Updated : 09 Sep, 2020

The areaRadial.angle() method is used to set or gets the angle accessor. The angle must be a number or a function that returns a number representing an angle in radians.

Syntax:

`areaRadial.angle(angle);`

Parameters: This method accepts single parameter as mentioned above and described below:

• angle: This parameter holds an angle that can be a number or a function returning the angle ranging (0 to 2Ï€) radians.

Return Value: This method returns the angle accessor of the area radial.

Example 1: The following example sets the angle using this method.

## HTML

 ` ` `<``html``> ` `<``head``> ` `    ``<``meta` `charset``=``"utf-8"``> ` ` `  `    ``<``script` `src``= ` `        ``"https://d3js.org/d3.v5.min.js"``> ` `    `` ` ` ` ` `  `<``body``> ` `    ``<``h1` `style``=``"text-align: center; color: green;"``> ` `        ``GeeksforGeeks ` `    `` ` ` `  `    ``<``h3` `style``=``"text-align: center;"``> ` `        ``D3.js | areaRadial.angle() Method ` `    `` ` ` `  `    ``<``center``> ` `        ``<``svg` `id``=``"gfg"` `width``=``"200"` `height``=``"200"``> ` `            ``<``g` `transform``=``"translate(100, 100)"``> ` `        `` ` `    `` ` ` `  `    ``<``script``> ` `        ``var points = [ ` `                ``{x: 0, y: 0}, ` `                ``{x: 2, y: 3}, ` `                ``{x: 4, y: 12}, ` `                ``{x: 6, y: 8}, ` `                ``{x: 8, y: 17}, ` `                ``{x: 10, y: 15}, ` `                ``{x: 12, y: 20}]; ` ` `  `        ``var xScale = d3.scaleLinear() ` `            ``.domain([0, 6]).range([0, 2 * Math.PI]); ` `        ``var yScale = d3.scaleLinear() ` `            ``.domain([0, 20]).range([90, 30]); ` ` `  `        ``var Gen = d3.areaRadial() ` `             ``// Setting the angle function ` `             ``.angle(d => xScale(d.x*4)) ` `             ``.innerRadius(d => yScale(d.y/6)) ` `             ``.outerRadius(d => yScale(d.y)); ` ` `  `        ``d3.select("#gfg") ` `          ``.select("g") ` `          ``.append("path") ` `          ``.attr("d", Gen(points)) ` `          ``.attr("fill", "green") ` `          ``.attr("stroke", "black"); ` `    `` ` ` ` ` `  ``

Output:

Example 2: The following example demonstrates getting the function for the angle.

## HTML

 ` ` `<``html``> ` ` `  `<``head``> ` `    ``<``meta` `charset``=``"utf-8"``> ` `    ``<``script` `src``= ` `        ``"https://d3js.org/d3.v5.min.js"``> ` `    `` ` ` ` ` `  `<``body``> ` `    ``<``h1` `style``=``"text-align: center; color: green;"``> ` `        ``GeeksforGeeks ` `    `` ` ` `  `    ``<``h3` `style``=``"text-align: center;"``> ` `        ``D3.js | areaRadial.angle() Method ` `    `` ` ` `  `    ``<``center``> ` `        ``<``svg` `id``=``"gfg"` `width``=``"200"` `height``=``"200"``> ` `            ``<``g` `transform``=``"translate(100, 100)"``> ` `        `` ` `    `` ` ` `  `    ``<``script``> ` `        ``var points = [ ` `                ``{x: 0, y: 0}, ` `                ``{x: 2, y: 3}, ` `                ``{x: 4, y: 12}, ` `                ``{x: 6, y: 8}, ` `                ``{x: 8, y: 17}, ` `                ``{x: 10, y: 15}, ` `                ``{x: 12, y: 20}]; ` ` `  `        ``var xScale = d3.scaleLinear() ` `            ``.domain([0, 6]).range([0, 2 * Math.PI]); ` `        ``var yScale = d3.scaleLinear() ` `            ``.domain([0, 20]).range([90, 30]); ` ` `  `        ``var Gen = d3.areaRadial() ` `             ``// Setting the angle function ` `             ``.angle(d => xScale(d.x*4)) ` `             ``.innerRadius(d => yScale(d.y/6)) ` `             ``.outerRadius(d => yScale(d.y)); ` ` `  `        ``d3.select("#gfg") ` `          ``.select("g") ` `          ``.append("path") ` `          ``.attr("d", Gen(points)) ` `          ``.attr("fill", "green") ` `          ``.attr("stroke", "black"); ` ` `  `        ``console.log(Gen.angle); ` `        ``console.log(Gen.angle()); ` `    `` ` ` ` ``

Output: