Rounded Rectangle
✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Aug 25, 2012
This example demonstrates how to draw a rectangle with rounded corners on only its right side using an SVG path. The code defines a function, `rightRoundedRect`, that constructs the necessary path data using absolute and relative commands, including an arc for the rounded corners. It uses D3.js v3 to append the path to an SVG container and centers it within the viewport. The visual result is a single gray shape with a black stroke, illustrating a technique commonly applied in custom chart annotations and UI elements.
AI-generated descriptionAn answer to Stack Overflow question: svg / d3.js rounded corner on one corner of a rectangle.
gpl-3.0 Licensed