ankane / vega-ruby

Interactive charts for Ruby, powered by Vega and Vega-Lite
BSD 3-Clause "New" or "Revised" License
251 stars 9 forks source link

`Uncaught ReferenceError: vegaEmbed is not defined` (even though Vega's js is loaded) #3

Closed dorianmariecom closed 2 years ago

dorianmariecom commented 2 years ago
Screenshot 2021-10-23 at 12 30 15 Screenshot 2021-10-23 at 12 29 36

Maybe related to Turbo, not sure, it happens when navigating to the page with charts from the homepage

= javascript_include_tag "admin", "data-turbo-track": "reload"

h1= t(".attendances")

= raw Stl.plot(Attendance.before_today.group_by_day(:created_at).count, Stl.decompose(Attendance.before_today.group_by_day(:created_at).count, period: 7))

h1(style="margin-top: 280px")= t(".users")

= raw Stl.plot(User.before_today.after_import.group_by_day(:created_at).count, Stl.decompose(User.before_today.after_import.group_by_day(:created_at).count, period: 7))

and in admin.js

//= require vega
//= require vega-lite
//= require vega-embed
dorianmariecom commented 2 years ago

fixed it by putting the admin.js in the head