1

I am trying to use chartkick to plot some charts with the google charts API. The problem is that the line to set everything up is taking 10-20 seconds to load. Here is the relevant line

<%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>

Has anyone else had this problem? If so how do you fix it?

jhlu87
  • 3,999
  • 8
  • 38
  • 48

2 Answers2

2

I don't know why this is, but I managed to get it to go fast by adding http: in the url

<%= javascript_include_tag "http://www.google.com/jsapi", "chartkick" %>
jhlu87
  • 3,999
  • 8
  • 38
  • 48
0

I generally get around this by grabbing a local copy of the file and only using it in development mode.

<% if Rails.env == "development" %>
  <%= #include the local file here %>
<% else %>
  <%= javascript_include_tag "http://www.google.com/jsapi", "chartkick" %>
<% end %>

Generally seems ok in production mode.

poho
  • 3
  • 3