3

When I want to draw a pie chart in SVG, all tutorials say that you need to calculate the end point of the arc element. Unless you want an exact 90° angle, that calculated point must unvariably fall beside the circumference line of the underlying circle because of rounding, if you scale up the scalable (!) graphic.

I cannot believe there is no way to draw a circle segment by giving a center, a radius and an angle.

Or is there?

  • have u looked at this question? http://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle – Fen1kz Mar 02 '15 at 15:02
  • In the URL posted by @Fen1kz, the last answer contains this `function describeArc(x, y, radius, startAngle, endAngle)` – Alvin K. Mar 03 '15 at 07:55
  • @AlvinK. But that is just a JS function that does the calculation. I don't have problems calculating the coordinates. I do know maths. What I find unbelievable is that while SVG *can* do polar coordinates in a circle (using center and radius), it seems to be unable to understand polar coordinates in an arc. This makes no sense at all. That is like calculating three points on the circumference of a circle to define it. Calculating the endpoint of the arc is cumbersome and unnecessary. So I think I must be overlooking the SVG arc element that *does* use a center, radius and angle. –  Mar 03 '15 at 08:05
  • The issue comes from `` only draws **full** circles while segments are created from `` using either `arcs` or `bezier curves` (more powerful but makes simple drawing a pain). – Alvin K. Mar 03 '15 at 08:25
  • VTC: either this Q isn't seeking an A, or if it is, the A is: [How to calculate the SVG Path for an arc (of a circle)](https://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle) – ashleedawg Jun 09 '21 at 02:59

0 Answers0