Answer the question
In order to leave comments, you need to log in
How to build a graph in Ruby on Rails (does not display data from one column)?
Hello, I'm trying to plot with the Morris gem, but it doesn't see the value of one of the columns.
There is a table, if you take other data that is in the database, then the graph works correctly. But in my table, in one of the columns, data is displayed that is not stored in the database, but is calculated in the model.
Here is the graph plotting
Morris.Bar({
element: 'doc_diagram',
data: $('#doc_diagram').data('doctor'),
xkey: 'doctor_first_name',
ykeys: ['current_money'],
labels: ['Series A']
});
%= content_tag :div, "", id: "doc_diagram", data: {doctor:
@doctor} %>
<% @doctor.each do |doc| %>
<tr>
<td><%= doc.doctor_first_name %></td>
<td><%= doc.doctor_second_name %></td>
<td><%= doc.current_money %></td>
<td><%= link_to 'Переглянути', doc %></td>
</tr>
<% end %>
</tbody>
def current_money
doctor_hour_price.to_f*users.where("enter_date >= ?", 7.days.ago).count
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question