mwlang / gentelella-rails

Injects the gentelella theme and javascript files into Rails assets pipeline
MIT License
155 stars 50 forks source link

Chart JS graphs does not render on rails.5.1.x #15

Closed ericeche closed 6 years ago

ericeche commented 6 years ago

Chart JS graphs does not seem to be rendering

ericeche commented 6 years ago

JS error: daterangepicker.self-348ba40a304d686ed1cfdf339c630869ae88a10c63ffeed27cf90aaa0e67379f.js?body=1:33 Uncaught ReferenceError: moment is not defined at daterangepicker.self-348ba40a304d686ed1cfdf339c630869ae88a10c63ffeed27cf90aaa0e67379f.js?body=1:33 at daterangepicker.self-348ba40a304d686ed1cfdf339c630869ae88a10c63ffeed27cf90aaa0e67379f.js?body=1:36 (anonymous) @ daterangepicker.self-348ba40a304d686ed1cfdf339c630869ae88a10c63ffeed27cf90aaa0e67379f.js?body=1:33 (anonymous) @ daterangepicker.self-348ba40a304d686ed1cfdf339c630869ae88a10c63ffeed27cf90aaa0e67379f.js?body=1:36 gentelella-custom.self-c52ac3373f52c5bb5a7133d569e72518649c034013faf28189ceee22e01a1e6a.js?body=1:806 init_sparklines gentelella-custom.self-c52ac3373f52c5bb5a7133d569e72518649c034013faf28189ceee22e01a1e6a.js?body=1:344 init_flot_chart gentelella-custom.self-c52ac3373f52c5bb5a7133d569e72518649c034013faf28189ceee22e01a1e6a.js?body=1:1056 init_wysiwyg gentelella-custom.self-c52ac3373f52c5bb5a7133d569e72518649c034013faf28189ceee22e01a1e6a.js?body=1:622 init_JQVmap gentelella-custom.self-c52ac3373f52c5bb5a7133d569e72518649c034013faf28189ceee22e01a1e6a.js?body=1:1933 init_EasyPieChart gentelella-custom.self-c52ac3373f52c5bb5a7133d569e72518649c034013faf28189ceee22e01a1e6a.js?body=1:1990 run_charts typeof [function] gentelella-custom.self-c52ac3373f52c5bb5a7133d569e72518649c034013faf28189ceee22e01a1e6a.js?body=1:1994 init_charts Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11 Uncaught TypeError: Cannot read property 'fontSize' of undefined at n.fit (Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11) at n.update (Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11) at Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11 at Object.each (Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11) at Object.update (Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11) at t.updateLayout (Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11) at t.update (Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11) at t.construct (Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11) at new t (Chart.min.self-d2e3f48f033faa936c8f9d6d794b77ef8dce4905124082a27affca7a4ae4e59a.js?body=1:11) at init_charts (gentelella-custom.self-c52ac3373f52c5bb5a7133d569e72518649c034013faf28189ceee22e01a1e6a.js?body=1:2173)

ericeche commented 6 years ago

added to the Gemfile to gentelella-rails-demo/examples/rails.5.1.x/Gemfile

gem 'chartjs-ror'

And graphs are being displayed now. Go figure

mwlang commented 6 years ago

Ok, great. Also, I think the newest release also solves this problem as moment.js was apparently loaded after daterangepicker, thus causing the error you were initially experiencing.