ankane / chartkick

Create beautiful JavaScript charts with one line of Ruby
https://chartkick.com
MIT License
6.33k stars 565 forks source link

Rails 7 Setup Additional Step Needed #613

Closed Jake839 closed 1 year ago

Jake839 commented 1 year ago

To get the charts to load in Rails 7, put <%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %> in application.html.erb Source: https://www.appsloveworld.com/ruby-on-rails/100/486/chartkick-not-loading-in-ruby-on-rails-7

ankane commented 1 year ago

Hi @Jake839, the current instructions work fine for Rails 7.

Jake839 commented 1 year ago

Oh ok Andrew. It actually wasn’t working for me until I did that step. I’m using Rails 7.0.6.

On Sep 9, 2023, at 2:52 PM, Andrew Kane @.***> wrote:

Closed #613 https://github.com/ankane/chartkick/issues/613 as completed.

— Reply to this email directly, view it on GitHub https://github.com/ankane/chartkick/issues/613#event-10324783714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUGTOPI6KODASUR3DBRDQATXZS3GRANCNFSM6AAAAAA4RTTJWM. You are receiving this because you were mentioned.

elbzero commented 6 months ago

Thanks so much! I had the same issue and this fixed it, @ankane could we consider re-opening this issue?

FYI I'm on rails (7.0.8) with chartkick (5.0.6) and using webpacker In my yarn lock chartkick@^5.0.1 with chart.js@^4.4.2

Initially when I added import "chartkick/chart.js"; I kept getting Error Loading Chart: No charting libraries found - be sure to include one before your charts, after adding @Jake839 suggested change it loads fine.

zhenshuo commented 5 months ago

The official instructions are working for my Rails 7.1.3 project with Importmap. I was facing the same issue, then realised it's because I didn't add <%= javascript_importmap_tags %> to application.html.erb