I'm trying to draw a good looking ellipse using RaphaelJS while only having the coordinates for the top, bottom, left and right points of the ellipse. The following image illustrates better what I need:

Example showing only the points and then the full ellipse

I've tried using most of the the curveto based commands the path method allows but none of them got somewhat close to what I need and frankly I can't wrap my head around the elliptical-arc command (A).

Any way I can work this out?

有帮助吗?

解决方案

You just need to use Raphael's ellipse: DEMO

var r = new Raphael(10,10, 500, 500);
var e = r.ellipse(50, 50, 40, 20).attr({fill: 'yellow', stroke:"red"});

Here ellipse(x, y, rx, ry)

  • x coordinate of the centre
  • y coordinate of the centre
  • horizontal radius
  • vertical radius

Hope this is what you wanted.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top