如何在rails中的chartkicks中显示数据计数和百分比
使用chartkicks
显示图表。 它仅显示百分比。 我想显示计数/金额以及百分比。
Chartkick
gem是Google Charts
上的一个包装器。 通过使用库选项,您可以指定要在legend
显示的值,并设置其他配置选项。
所以类似于:
<%= pie_chart visits.group(:country).count, library: {pieSliceText: 'value-and-percentage'} %>
有关更多配置选项,请参阅此链接: https : //developers.google.com/chart/interactive/docs/gallery/piechart#configuration-options