package.src.symbol.diamond.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of d3-shape Show documentation
Show all versions of d3-shape Show documentation
Graphical primitives for visualization, such as lines and areas.
var tan30 = Math.sqrt(1 / 3),
tan30_2 = tan30 * 2;
export default {
draw: function(context, size) {
var y = Math.sqrt(size / tan30_2),
x = y * tan30;
context.moveTo(0, -y);
context.lineTo(x, 0);
context.lineTo(0, y);
context.lineTo(-x, 0);
context.closePath();
}
};