Charts in Ruby on Rails with Repl

Question:

As the title suggests, I’m trying to make a ruby on rails website which has a chart. I googled and found chartkick seems to be the most popular, and it says it is already installed in the packages of the Rails template in Repl!
However when adding the code as per the example it is stuck at “loading”. I suspect is has something to do with Javascript? Do I need to do anything to enable it?
Thanks in advance for any help.

Repl link:

https://replit.com/@leggman7/Rail-Exercise-App

<%= line_chart [["2021-01-01", 1], ["2021-01-02,3"]] %>

Chartkick relies on either the Google Charts library or the Chart.js library. You must include one of these in your project.

Also there is a typo here, it’s missing a closing double-quote for the date:

Just put the double-quote in the right place:

<%= line_chart [["2021-01-01", 1], ["2021-01-02", 3]] %>
1 Like

Thanks but that’s not it (and sorry about the typo that is a red herring). I created another Repl from a different template instead of the standard rails one, and this one works fine. It also has a javascript folder in the list of files, and the description said that included a bunch more things. So I think I was right in that I didn’t have javascript enabled/installed/something.
Here is the template:

https://replit.com/@lcuevastodoit/Rails-7-Turbo-Rails-Demo-template

1 Like