drawio-function-plot-plugin

Function Plot plugin for Draw.io Desktop.

Stars
10

Draw.io: Function Plot Plugin

The project is based on drawio_chartjs_plugin and function-plot.

Usage

Double click on a shape and edit the JSON, the shape will be redrawn after leaving the editor.

You can visit the website of Function Plot for more documents.

Installation

1. Enable unsafe-eval for Drawio Desktop

Because Function Plot use eval() function, and eval() function is blocked by Content Security Policy of Electron, it is neccessary to find the way around it.

Firstly, find the file path of drawio desktop and there are a file name app.asar.

For example, my app.asar file is in /opt/drawio/resources.

Secondly, install asar tool to extract the app.asar file. (You can backup your app.asar file.)

# install
npm install -g asar

# extract
asar extract app.asar src

Thirdly, modify the index.html in src/, and add \'unsafe-eval\' after 'default-src \'self\' \'unsafe-inline\'.

Finally, repack the src\ into app.asar.

# repack
asar pack src app.asar

And if you can open drawio successfully, it is ok.

2. Install Plugin

  • Download function-plot-plugin.webpack.js file in Releases.
  • Click on Extras, then Plugins....
  • Click Add....
  • Click Select File...
  • Select function-plot-plugin.webpack.js file and then Apply.
  • Reboot and then you can enjoy it!