chartjs / chartjs-chart-financial

Chart.js module for charting financial securities
MIT License
742 stars 199 forks source link

Error when upgrading from Chart.js 3.0 to 4.4 #150

Open biren34 opened 11 months ago

biren34 commented 11 months ago

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 to .

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!

attilacsanyi commented 9 months ago

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

santam85 commented 7 months ago

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.

varad11 commented 7 months ago

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"

santam85 commented 6 months ago

@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

varad11 commented 6 months ago

@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.)

santam85 commented 6 months ago

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.