I am using the Network layout and I wanted to show node in a hexagon shape, for that, I have added following in code snippet in the lib/network/shapes.js
/**
Draw a Hexagon shape with 6 sides
@Param {Number} x horizontal center
@Param {Number} y vertical center
@Param {Number} r radius
*/
CanvasRenderingContext2D.prototype.hexagon = function(x, y, r) {
var a = Math.PI2 / 6;
this.beginPath();
this.translate(x, y);
this.moveTo(radius, 0);
for (var i = 1; i < sides; i++) {
this.lineTo(radiusMath.cos(ai), radiusMath.sin(ai));
}
this.closePath();
};
should I need to update the vis.js file too?
Here is the answer https://github.com/almende/vis/pull/3420, and it also merged in the vis.js github