使用 chartkicks 显示图表 . 它仅显示百分比 . 我想显示计数/金额以及百分比 .
chartkicks
<%= pie_chart visits.group(:country).count %>
Chartkick gem是 Google Charts 之上的包装器 . 通过使用库选项,您可以指定要在 legend 中显示的值,并设置其他配置选项 .
Chartkick
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
1 回答
Chartkick
gem是Google Charts
之上的包装器 . 通过使用库选项,您可以指定要在legend
中显示的值,并设置其他配置选项 .所以类似于:
有关更多配置选项,请参阅此链接:https://developers.google.com/chart/interactive/docs/gallery/piechart#configuration-options