Maximilian Fornacon
Maximilian Fornacon

Reputation: 35

morris.js error in Ruby on Rails

I'm getting an error when I try to use morris.js in my Ruby on Rails project.

Uncaught TypeError: Cannot read property 'length' of undefined

This is my file

= content_tag :div, "", id: "weights_chart", data: {weights: @weights}
:javascript
   new Morris.Line({
       element: 'weights_chart',
       data: $('#weights_chart').data('weights'),
       xkey: 'created_at',
       ykey: ['data'],
       labels: ['Weight']
   });

Upvotes: 0

Views: 66

Answers (1)

brettkc
brettkc

Reputation: 250

ykey should be ykeys most likely.

Upvotes: 1

Related Questions