chartjs/chartjs-chart-financial

Error when upgrading from Chart.js 3.0 to 4.4

Opened this issue · 6 comments

First, thank you for this great candlestick plot.

I downloaded the example and was able to get it running with my data. I then tried to upgrade to chart.js 4.4 by changing the include in index.html from <script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.1/dist/chart.js"></script> to <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>.

I now get an "Uncaught TypeError: String.prototype.toString requires that 'this' be a String" error, with a pretty unhelpful call stack:
image

Any help would be appreciated!

We have the same issue @biren34, any update on this did you manage to solve the issue above? Thank you so much.

It seems to be due to incomplete datasets defaults for the library and some assumptions Chart.js makes on the default property values, working on it and releasing a new patch soon, it will require a breaking change to the configuration of the financial charts datasets.

I face this issue when I do npm i chartjs-chart-financial
I'm using "chart.js": "4.4.2".

This is the error I get:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: my_app@0.0.0
npm ERR! Found: chart.js@4.4.2
npm ERR! node_modules/chart.js
npm ERR!   chart.js@"4.4.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer chart.js@"^3.2.0" from chartjs-chart-financial@0.1.1
npm ERR! node_modules/chartjs-chart-financial
npm ERR!   chartjs-chart-financial@"*" from the root project

I see that @santam85 submitted a PR which is reviewed with no conflicts. So if it is merged to master and released on npm then that would be really helpful for all.

**Temporarily for now I have installed the major/chartjs-4 branch created by @santam85 to continue with my development.
Here is the command:
npm i "github:chartjs/chartjs-chart-financial#major/chartjs-4"

@varad11 any issues encountered with the branch version? If it looks good from your end I can try releasing (first time for me on this lib). Fixed by #170

@santam85 I tried but, the dist folder was missing after npm i "github:chartjs/chartjs-chart-financial#major/chartjs-4" command. Only types got installed. I checked package.json and the "module" field points to "dist/chartjs-chart-financial.min.js".

chart-fin

Since the actual files are missing, my console keeps showing bunch of errors.
I was using react-chartjs-2 wrapper over chart.js.

(I have now switched to different charting library because of the reoccurring compatibility issues between chart.js and it's plugins and react wrapper integrations.)

Please have a try with v0.2.0, you'll need to change your dataset options in accordance to what is shown in the updated examples.