-
Notifications
You must be signed in to change notification settings - Fork 1.5k
How to add custom Shape in Vis.Js ? #3436
Comments
The steps in #3418 have been proven and confirmed to work. What issues are you running into? I'll need more info to be able to give a relevant answer. |
We have follow all below steps Step 1: vis/lib/network/shapes.js /**
* Draw a mydesign shape
* @param {Number} x horizontal center
* @param {Number} y vertical center
* @param {Number} r size, width and height of the mydesign
*/
CanvasRenderingContext2D.prototype.mydesign = function (x, y, r) {
this.beginPath();
this.rect(x - r, y - r, r * 2, r * 2);
this.closePath();
}; Step 2: File name : Mydesign.js vis/lib/network/modules/components/nodes/shapes/Mydesign.js Step 3: var Mydesign = require('./nodes/shapes/Mydesign').default; And case 'mydesign':
this.shape = new Mydesign(this.options, this.body, this.labelModule);
break; File Path : vis/lib/network/modules/components/Node.js Step 4: We have added shape twice time in below path file : /vis/lib/network/options.js Step 5: // create an array with nodes
var nodes = new vis.DataSet([
{id: 1, label: 'Node 1', shape:'mydesign'},
{id: 2, label: 'Node 2'},
{id: 3, label: 'Node 3'},
{id: 4, label: 'Node 4'},
{id: 5, label: 'Node 5'}
]); File Path : vis/examples/network/basicUsage.html Please check and help us |
Urgh. That Please think up an alternative method of showing the files. E.g. the separate files you changed would be helpful. Or a clone on github of the |
I have made clone at github |
Yes, it's working.....i was forget to do "gulp" so it was not worked. Now it's working fine thank you so much :) i need one more help that can we add anchor links and HTML tag with class or id in NODE because we want create a IVR flow from vis.js.....is it possible or not ? |
Just say to yourself 'TIL'. No, links don't work in the node labels and HTML tag support is very limited. |
Please make sure to read the following list before creating a new issue:
I have follow all these step of below issue but there are nothing effective :
#3418
Please find attachment and help us
vis.tar.gz
The text was updated successfully, but these errors were encountered: