Thanks a lot to all of you for the links. I will explore these.
Although it would be great if this functionality is added to d3.js. It is very useful when drawing geometrical figures and economics diagrams.
Drawing packages in LaTeX such as TikZ also have this functionality.
Thanks again.