chartjs / chartjs/chartjs-chart-financial

Running on NodeJS

Open
#111 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
809
Forks
199
PR merge metrics
No merged PRs in 30d

Description

While running this plugin on NodeJS we are getting this error (running ChartJS via my [lib](https://github.com/SeanSobey/ChartjsNodeCanvas)):
```
(node:8700) UnhandledPromiseRejectionWarning: ReferenceError: window is not defined
at afterBuildTicks (/home/../node_modules/chartjs-chart-financial/dist/chartjs-chart-financial.min.js:11:2437)
at callback (/home/../node_modules/chart.js/dist/chart.js:800:15)
at TimeSeriesScale._callHooks (/home/../node_modules/chart.js/dist/chart.js:5099:5)
at TimeSeriesScale.afterBuildTicks (/home/../node_modules/chart.js/dist/chart.js:5115:10)
at TimeSeriesScale.update (/home/../node_modules/chart.js/dist/chart.js:5037:10)
...
```
Obviously, the error is from the `window` reference. It looks to just be the one reference, when checking for Luxon, and it can be resolved via something like this:
```
afterBuildTicks: scale => {
if (!('window' in this)) {
return;
}
const DateTime = window && window.luxon && window.luxon.DateTime;
if (!DateTime) {
return;
}
...
```
I am happy to test and submit this via pull request but am just inquiring about interest and appetite to support NodeJS with this fix and going forward?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.