Topic: Can't resolve react-chartjs-2

pcdavis pro asked 6 years ago

When I try to implement a chart, I get the error 'Can't resolve react-chartjs-2'. Isn't it included as a dependency of MDB? Do I need to install react-chartjs-2 by myself?    

Mikołaj Smoleński staff answered 6 years ago

Hi Paul, Thanks for Your advice. We'll consider adding that information to the React documentation. Regards

Mikołaj Smoleński staff answered 6 years ago

Hello, You need to add react-chartjs-2 as Your own dependency and then import it is written here: It is not included in MDB React because only few users need such components. Regards

pcdavis pro commented 6 years ago

Hi Miolaj, Thanks for your response. I have the chart working now, but not due to any of the documentation on your site. Here is the extent of the documentation regarding dependencies on your docs page for charts: import {Line} from 'react-chartjs-2'; I'm sure an experienced programmer would be able to deduce the react-chartjs-2 from the single import statement you provided for the Line component, but even then there is no mention of needing chart.js as well, which it turns out you do. I really like the concept of MDB. I'm assuming you are targeting MDB to a wider audience that includes newer developers like myself, so it might be worth carving out 4 hours of someone's day there at MDB to go through the docs and add a few simple steps required to use each library of components. I think it will save you hundreds of hours of tech support and make your customers happy. Here's what I think you should add to the top of the charts page: In order to use the chart components found here in MDB, be sure to install the following two npm packages and save them as dependencies: react-chartsjs-2 and charts.js npm install --save react-chartsjs-2 and chart.js

Diego Torres free commented 3 years ago

it really is too complex for novice developers, sorry to have bought the PRO version

Wojciech Staniszewski staff commented 3 years ago

We will take this into consideration when developing MDB 5 Charts. Thanks for Your advice

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB React
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No