How to show count of data along with percentage in chartkicks in rails

后端 未结 1 1784
北海茫月
北海茫月 2021-01-23 11:07

Using chartkicks for showing charts. It show percentage only . I want to show count/amount along with percentage.

<%= pie_chart visits.group(:cou         


        
相关标签:
1条回答
  • 2021-01-23 11:49

    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

    0 讨论(0)
提交回复
热议问题