[英]generating graphs using chartkick in rails 4
I am using chartkick to generate graphs in my Rails 4 application. 我正在使用chartkick在我的Rails 4应用程序中生成图形。 I need to map the clickcount of each of my affiliates into a graph for the maintainer of the affiliate sites.
我需要将每个会员的点击数映射到会员网站维护者的图表中。 So I have used the following
所以我用了以下
<%= column_chart [name:@affiliate_person.affiliates.map{|t| [t.name]} , data: @affiliate_person.affiliates.map{|t| [t.click_count] }] %>
Each affiliate_person will have many affiliates and I want to show for each affiliate site how much clicks have been generated. 每个affiliate_person将有许多会员,我想显示每个会员网站产生了多少点击。 How do I do this?
我该怎么做呢? The readme is not very helpful
自述文件不是很有帮助
I believe the issue is a column chart just needs a 1-1 association for a label of the data and the amount to represent. 我认为问题在于柱形图只需要1-1关联即可表示数据的标签和要表示的数量。 Try this:
尝试这个:
column_chart @affiliate_person.affiliates.map { |t| [t.name, t.click_count] }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.