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

Check for NaN #67

Open
andrewgoz opened this issue Aug 8, 2023 · 0 comments
Open

Check for NaN #67

andrewgoz opened this issue Aug 8, 2023 · 0 comments

Comments

@andrewgoz
Copy link

andrewgoz commented Aug 8, 2023

I've been working on an integration of ApexCharts (which uses this library) with TiddlyWiki and noticed some exceptions in the console. I've tracked them down to the code below that has issues where the size of the chart has been set to 0 during code that is disposing of dynamically-generated charts.

var aspectRatio = this.parameters.box.width / this.parameters.box.height;

Needs the following after it:

if (Number.isNaN(aspectRatio)) {
  aspectRatio = 1;
}

and

var newAspectRatio = newW / newH;

needs the following after it:

if (Number.isNaN(newAspectRatio)) {
  newAspectRatio = 1;
}

Edit: It has occurred to me that this could also be done like:

if (this.parameters.box.width == 0 || this.parameters.box.height == 0) {
  aspectRatio = 1;
}

and

if (newW == 0 || newH == 0) {
  aspectRatio = 1;
}
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

No branches or pull requests

1 participant