Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tmatz/93d18cfa2750ed5307d6 to your computer and use it in GitHub Desktop.
Save tmatz/93d18cfa2750ed5307d6 to your computer and use it in GitHub Desktop.

vis.js の改造

vis.js は矢印の形をかえることができないので、UML 的な図を書くことができない。

改造できないか調べてみる

ubuntu で vis.js をビルドする

git clone https://github.com/almende/vis.git
sudo install npm-legacy
cd vis
npm install
npm run build
  • /usr/bin/node が必要なので npm-legacy をインストールする。

改造

矢印の形は lib/network/shapes.js で定義されているっぽい。

CanvasRenderingContext2D.prototype.arrow = function (x, y, angle, length) { ...

arrow() を呼び出しているのは以下の2ヶ所。

  • lib/network/modules/components/edges/util/EdgeBase.js
  • lib/network/modules/PhysicsEngine.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment