问题
Using chartkicks
for showing charts. It show percentage only . I want to show count/amount along with percentage.
<%= pie_chart visits.group(:country).count %>
回答1:
Chartkick
gem is a wrapper on top of Google Charts
. By using library option you can specify what value to show in the legend
and set other configuration options.
So something like:
<%= pie_chart visits.group(:country).count, library: {pieSliceText:
'value-and-percentage'} %>
See this link for more configuration options: https://developers.google.com/chart/interactive/docs/gallery/piechart#configuration-options
来源:https://stackoverflow.com/questions/35197744/how-to-show-count-of-data-along-with-percentage-in-chartkicks-in-rails