Plugin: Function Plot

I have been shopping around for a plotting library that can be used with Joplin and finally found it.
This plugin will help plotting mathematical function such as $y = x^2$ right in joplin.

I have been developing this in a hurry so not sure if it has any bug but as the implementation is quite straightforward it's probably find. Please find the usage instruction in github

The release version should be available on the plugin repository soon.

9 Likes

Hi @hieuthi , this is really the one which I'm trying to find out! Thanks so much for your work !

Just one question, when I installed the plugin, and tried with a example function-plot snippet, I just got an Parsing Error, would you please give me some advice here ?

image

image
Here is the Joplin version info

Joplin 3.1.1 (prod, darwin)

Client ID: eb2d1e1494234b77b3f9cd026a11b753
Sync Version: 3
Profile Version: 47
Keychain Supported: Yes

Revision: a97c04c

Admonition markdown extension: 1.1.0
Agenda: 3.7.1
Auto Alarm: 1.0.8
Backup: 1.4.2
Enhancement: 1.2.1
Function Plot: 1.0.0
History Panel: 1.0.2
Inline tags: 1.3.0
Inline TODO: 1.7.1
Markdown Table: Colorize: 1.2.0
Math Mode: 0.6.2
Templates: 2.4.1
MultiMarkdown Table Tools: 1.2.1
Note Link System: 0.8.0
Note Rename: 1.0.0
Note Tabs: 1.4.1
Outline: 1.5.13
Repeating To-Dos: 0.11.0
Rich Markdown: 0.15.0
turnToChart: 1.9.3
VS-Code Style Note Search: 0.0.1
Whitespacer: 1.0.1

Hmmm, the example looks correctly to me.

It probably conflicts with another plugin. Maybe Inline Tags.
Please try remove the "target": "#quadratic", and see if it change anything. That line is actually not essential.

Hi @hieuthi , thanks for your reply!
I found the reason, it's the new Joplin version caused this error, as when I downgrade to Joplin v3.0.14, it works fine.

Joplin 3.0.14 (prod, darwin)

Client ID: eb2d1e1494234b77b3f9cd026a11b753
Sync Version: 3
Profile Version: 47
Keychain Supported: Yes

Revision: 05cf51e

1 Like

Thank you for reporting this! The issue seems to be caused by this Joplin commit.

Explanation of the issue:
Currently, function-plot.js stores functionPlot on the global exports object, if it exists. This upstream commit added an exports object to the note preview pane to silence a warning caused by generated Webpack code.

Previously, exports did not exist and function-plot.js stored the functionPlot function in the global self variable.

Possible fix:
I suggest 1) reverting the related upstream commit and 2) changing the default Webpack template to make extraScripts target web by default, rather than node. Such a change may also simplify loading libraries like transformers.js in a plugin.

Update: Pull request: Desktop: Fix viewer and panel plugins that check for the presence of `exports` fail to load by personalizedrefrigerator · Pull Request #10900 · laurent22/joplin · GitHub

1 Like