Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

custom triangle shape for node in network #3920

Open
ghost opened this issue Apr 9, 2018 · 0 comments
Open

custom triangle shape for node in network #3920

ghost opened this issue Apr 9, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Apr 9, 2018

In the network, I want to add a function for a custom triangle shape by myself as #3418. For example,

// create an array with nodes
  var nodes = new vis.DataSet([
    {id: 1, label: 'Node 1', shape: customTriangle([0,0],[100,100],[100,0])}
  ]);

In the vis/lib/network/shapes.js, how to make such function? Is it possible to make such function as following?

/**
   * Draw a custom triangle shape
   * @param {Number} x horizontal center
   * @param {Number} y vertical center
   * @param {Number} r   radius
   * @param {Number} x1   first x-coordinate of a triangle
   * @param {Number} y1   first y-coordinate of a triangle
   * @param {Number} x2   second x-coordinate of a triangle
   * @param {Number} y2   second y-coordinate of a triangle
   * @param {Number} x3   third x-coordinate of a triangle
   * @param {Number} y3   third y-coordinate of a triangle
   */
  CanvasRenderingContext2D.prototype.customTriangle = function (x, y, r, x1, y1, x2, y2, x3, y3) {
...
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants