-
Notifications
You must be signed in to change notification settings - Fork 457
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
[BUG] Weird behavior with labels #368
Comments
This must be related to this library, because doing the require in the for loop with some tweeks to fresh require it, everything is working fine. // https://github.com/hughsk/fresh-require
export const freshRequire: /*NodeJS.Require*/ (id: string) => any = (file) => {
const resolvedFile = require.resolve(file);
const temp = require.cache[resolvedFile];
delete require.cache[resolvedFile];
// eslint-disable-next-line @typescript-eslint/no-var-requires
const modified = require(resolvedFile);
require.cache[resolvedFile] = temp;
return modified;
};
// run only for top=60 => perfect result
//for (let top = 45; top <= 45; top += 5) {
// run a few values for top more => only a few bad
for (let top = 40; top < 70; top += 5) {
// run from 0 to 100 in 5er steps => everything bad
// for (let top = 0; top < 100; top += 5) {
// import via require as it doesnt work otherwise
// eslint-disable-next-line @typescript-eslint/no-var-requires
const ChartDataLabels = freshRequire('chartjs-plugin-datalabels');
[...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I experienced a really weird behavior with my labels and don't know why. Im using this package in combination with
chartjs-node-canvas
.Description
The provided example code has three different for loop heads which work/don't work.
The weird part is, that it works if the for loop only runs one iteration. If it runs only a few iterations, it's sometimes correct and if its runs 20 iterations nothing is correct.
Screenshots
Correct:
![working](https://user-images.githubusercontent.com/76838159/215261689-f29d7e4b-14e0-45f1-afb3-072b88087a02.png)
Wrong:
![not-working](https://user-images.githubusercontent.com/76838159/215261696-9c80c6a2-6b21-45d3-bda4-bb65b6f6a98d.png)
Look at the placement of the labels. In the correct one, the labels are placed ontop of the bars, in the wrong one they are wrapped somehow.
Steps to reproduce
index.ts
file calleda
.npx ts-node index.ts
and try all 3 for heads. (Remember to remove all files ina/
first to have no conflicts)Example code
package.json
:The text was updated successfully, but these errors were encountered: