Sha256: 96faa0a2c4690be7d99d3748a952de73f9ea8e57d296fc44a2129d842736a550
Contents?: true
Size: 1.45 KB
Versions: 23
Compression:
Stored size: 1.45 KB
Contents
pv.SvgScene.label = function(scenes) { var e = scenes.$g.firstChild; for (var i = 0; i < scenes.length; i++) { var s = scenes[i]; /* visible */ if (!s.visible) continue; var fill = s.textStyle; if (!fill.opacity || !s.text) continue; /* text-baseline, text-align */ var x = 0, y = 0, dy = 0, anchor = "start"; switch (s.textBaseline) { case "middle": dy = ".35em"; break; case "top": dy = ".71em"; y = s.textMargin; break; case "bottom": y = "-" + s.textMargin; break; } switch (s.textAlign) { case "right": anchor = "end"; x = "-" + s.textMargin; break; case "center": anchor = "middle"; break; case "left": x = s.textMargin; break; } e = this.expect(e, "text", { "pointer-events": s.events, "cursor": s.cursor, "x": x, "y": y, "dy": dy, "transform": "translate(" + s.left + "," + s.top + ")" + (s.textAngle ? " rotate(" + 180 * s.textAngle / Math.PI + ")" : "") + (this.scale != 1 ? " scale(" + 1 / this.scale + ")" : ""), "fill": fill.color, "fill-opacity": fill.opacity || null, "text-anchor": anchor }, { "font": s.font, "text-shadow": s.textShadow, "text-decoration": s.textDecoration }); if (e.firstChild) e.firstChild.nodeValue = s.text; else e.appendChild(document.createTextNode(s.text)); e = this.append(e, scenes, i); } return e; };
Version data entries
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
rubyvis-0.1.3 | vendor/protovis/src/scene/SvgLabel.js |
rubyvis-0.1.2 | vendor/protovis/src/scene/SvgLabel.js |
rubyvis-0.1.1 | vendor/src/scene/SvgLabel.js |