Adding Image API tu use in custom functions #198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thisImage
API at v4.1.3This 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.