Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Image API tu use in custom functions #198

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nalo26
Copy link

@nalo26 nalo26 commented Jun 13, 2024

Hello!

We wanted to use Quickchart internally and self hosting it using Docker. Everything worked perfectly, until the day we wanted to include images into the labels of the generated charts.

We came across this Stackoverflow answer that shows an example of custom function to achieve that. The only difference is that we're using the Python module, so we couldn't do exactly the same, and had to create the Javascript Image objects on our side. It has to be done on the Chart.js injected script.

However, I encounter the issue of Image not being accessible from the inside of Quickchart/Chart.js. By looking at the code of chartjs-node-canvas used by Quickchart, I saw that they added the access to this Image API at v4.1.3

This PR is nothing more than the upgrade of the chartjs-node-canvas module to v4.1.3 (and another dependency upgrade fix).
Unfortunately in this version they removed the possibility to dynamically instantiate the version of chart.js used, as they load it by their side. But by doing a bit of trickery, I still managed to achieve it.

The python script added is nothing more than an example of usage that perfectly works to reproduce the example from the Stackoverflow's answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant