1 pv.SvgScene.dot = 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 radius = s.radius, path = null; 13 switch (s.shape) { 14 case "cross": { 15 path = "M" + -radius + "," + -radius 16 + "L" + radius + "," + radius 17 + "M" + radius + "," + -radius 18 + "L" + -radius + "," + radius; 19 break; 20 } 21 case "triangle": { 22 var h = radius, w = radius * 1.1547; // 2 / Math.sqrt(3) 23 path = "M0," + h 24 + "L" + w +"," + -h 25 + " " + -w + "," + -h 26 + "Z"; 27 break; 28 } 29 case "diamond": { 30 radius *= Math.SQRT2; 31 path = "M0," + -radius 32 + "L" + radius + ",0" 33 + " 0," + radius 34 + " " + -radius + ",0" 35 + "Z"; 36 break; 37 } 38 case "square": { 39 path = "M" + -radius + "," + -radius 40 + "L" + radius + "," + -radius 41 + " " + radius + "," + radius 42 + " " + -radius + "," + radius 43 + "Z"; 44 break; 45 } 46 case "tick": { 47 path = "M0,0L0," + -s.size; 48 break; 49 } 50 case "bar": { 51 path = "M0," + (s.size / 2) + "L0," + -(s.size / 2); 52 break; 53 } 54 } 55 56 /* Use <circle> for circles, <path> for everything else. */ 57 var svg = { 58 "shape-rendering": s.antialias ? null : "crispEdges", 59 "pointer-events": s.events, 60 "cursor": s.cursor, 61 "fill": fill.color, 62 "fill-opacity": fill.opacity || null, 63 "stroke": stroke.color, 64 "stroke-opacity": stroke.opacity || null, 65 "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null 66 }; 67 if (path) { 68 svg.transform = "translate(" + s.left + "," + s.top + ")"; 69 if (s.angle) svg.transform += " rotate(" + 180 * s.angle / Math.PI + ")"; 70 svg.d = path; 71 e = this.expect(e, "path", svg); 72 } else { 73 svg.cx = s.left; 74 svg.cy = s.top; 75 svg.r = radius; 76 e = this.expect(e, "circle", svg); 77 } 78 e = this.append(e, scenes, i); 79 } 80 return e; 81 }; 82