D3.js arc.innerRadius() Function

The arc.innerRadius function in d3.js is used to set the inner radius of the arc. It takes a number that defines the inner radius of the arc.
Syntax:
arc.innerRadius([radius]);
Parameters: This function accepts a single parameter as mentioned above and described below.
- radius: This defines the size of the inner radius of the arc.
Return Values: This function does not return anything.
Example 1:
HTML
| <!DOCTYPE html> <htmllang="en"> <head>     <metacharset="UTF-8"/>     <metaname="viewport"          content="width=device-width,                    initial-scale=1.0"/>     <!--Fetching from CDN of D3.js -->    <scriptsrc=     </script></head><body>     <divstyle="width:300px; height:300px;">        <center>            <h1style="color:green">                zambiatek            </h1>             <h2>                arc.innerRadius()            </h2>         </center>        <svgwidth="300"height="300">        </svg>    </div>    <script>         var svg = d3.select("svg")            .append("g")            .attr("transform", "translate(150,100)");        // Arc gernerator function        var arc = d3.arc()            .outerRadius(0)            // Use of innerRadius Function             .innerRadius(60)            .startAngle(0)            .endAngle(10);        svg.append("path")            .attr("class", "arc")            .attr("d", arc);        let p = document.querySelector(".arc");        p.style.fill="green";    </script> </body> </html> | 
Output:
Example 2:
HTML
| <!DOCTYPE html> <htmllang="en"> <head>     <metacharset="UTF-8"/>     <metaname="viewport"          content="width=device-width,                    initial-scale=1.0"/>         <!--Fetching from CDN of D3.js -->    <scriptsrc=     </script></head><body>     <divstyle="width:300px; height:300px;">        <center>            <h1style="color:green">                zambiatek            </h1>             <h2>                arc.innerRadius()            </h2>         </center>        <svgwidth="300"height="300">        </svg>    </div>    <script>         var svg = d3.select("svg")            .append("g")            .attr("transform", "translate(150,100)");        // Arc generator function        var arc = d3.arc()            .outerRadius(10)            // Use of innerRadius Function             .innerRadius(50)            .startAngle(0)            .endAngle(10);        svg.append("path")            .attr("class", "arc")            .attr("d", arc);        let p = document.querySelector(".arc");        p.style.fill="green";    </script> </body> </html> | 
Output:
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
 
				 
					



