简体   繁体   中英

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']
   });

ykey应该是最有可能的ykeys

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM