ankane / chartkick

Create beautiful JavaScript charts with one line of Ruby

Home Page:https://chartkick.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rails 7 Setup Additional Step Needed

Jake839 opened this issue · comments

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

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

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.

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