1 pv.SvgScene.wedge = function(scenes) { 2 var e = scenes.$g.firstChild; 3 for (var i = 0; i < scenes.length; i++) { 4 var s = scenes[i]; 5 6 /* visible */ 7 if (!s.visible) continue; 8 var fill = s.fillStyle, stroke = s.strokeStyle; 9 if (!fill.opacity && !stroke.opacity) continue; 10 11 /* points */ 12 var r1 = s.innerRadius, r2 = s.outerRadius, a = Math.abs(s.angle), p; 13 if (a >= 2 * Math.PI) { 14 if (r1) { 15 p = "M0," + r2 16 + "A" + r2 + "," + r2 + " 0 1,1 0," + (-r2) 17 + "A" + r2 + "," + r2 + " 0 1,1 0," + r2 18 + "M0," + r1 19 + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) 20 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 21 + "Z"; 22 } else { 23 p = "M0," + r2 24 + "A" + r2 + "," + r2 + " 0 1,1 0," + (-r2) 25 + "A" + r2 + "," + r2 + " 0 1,1 0," + r2 26 + "Z"; 27 } 28 } else { 29 var sa = Math.min(s.startAngle, s.endAngle), 30 ea = Math.max(s.startAngle, s.endAngle), 31 c1 = Math.cos(sa), c2 = Math.cos(ea), 32 s1 = Math.sin(sa), s2 = Math.sin(ea); 33 if (r1) { 34 p = "M" + r2 * c1 + "," + r2 * s1 35 + "A" + r2 + "," + r2 + " 0 " 36 + ((a < Math.PI) ? "0" : "1") + ",1 " 37 + r2 * c2 + "," + r2 * s2 38 + "L" + r1 * c2 + "," + r1 * s2 39 + "A" + r1 + "," + r1 + " 0 " 40 + ((a < Math.PI) ? "0" : "1") + ",0 " 41 + r1 * c1 + "," + r1 * s1 + "Z"; 42 } else { 43 p = "M" + r2 * c1 + "," + r2 * s1 44 + "A" + r2 + "," + r2 + " 0 " 45 + ((a < Math.PI) ? "0" : "1") + ",1 " 46 + r2 * c2 + "," + r2 * s2 + "L0,0Z"; 47 } 48 } 49 50 e = this.expect(e, "path", { 51 "shape-rendering": s.antialias ? null : "crispEdges", 52 "pointer-events": s.events, 53 "cursor": s.cursor, 54 "transform": "translate(" + s.left + "," + s.top + ")", 55 "d": p, 56 "fill": fill.color, 57 "fill-rule": "evenodd", 58 "fill-opacity": fill.opacity || null, 59 "stroke": stroke.color, 60 "stroke-opacity": stroke.opacity || null, 61 "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null 62 }); 63 e = this.append(e, scenes, i); 64 } 65 return e; 66 }; 67