0

My Morris Line chart is not showing on initial page load. Manually using the browser refresh will result in the chart displaying as expected. This is under Rails 5 and Chrome/Safari/Firefox. My coffeescript file.

jQuery ->
  Morris.Line({
    resize:true,
    parseTime:false,
    hideHover:true,
    xLabelAngle:45,
    ymin:100,
    ymax:300,
    element: 'game_averages'
    data: $('#game_averages').data('averages')
    xkey: 'game_title'
    ykeys: ['athlete','field']
    labels: ['Favorite','Field']}
  )

This is based on an old RailsCast http://railscasts.com/episodes/223-charts-graphs-revised

Bingo
  • 31
  • 1
  • 6
  • This sounds like a problem with `turbolinks` - have a look at [this answer](https://stackoverflow.com/questions/36110789/rails-5-how-to-use-document-ready-with-turbo-links) – caffeinated.tech Oct 15 '19 at 09:33

1 Answers1

0

@caffinated.tech was right with their answer "This sounds like a problem with turbolinks - have a look at this answer "

Bingo
  • 31
  • 1
  • 6