2

I want to show count of data along with percentage.It works but for small percentages nothing appear due to small size.Is it possible to show count and percentage outside chart.Or where list of interests along with them.

<%= pie_chart users.joins(:relationship_status).group('relationship_statuses.name').count, library: {legend: {labelFormat: '{name} : {y} ({percentage:.1f}%)'}} %>   

enter image description here

Haseeb Ahmad
  • 7,914
  • 12
  • 55
  • 133

1 Answers1

0

You can show them in legends. The list where you are showing legends you can put % of each. to do so :

    legend: {
    labelFormat: '{name} : {y} ({percentage:.1f}%)',
     layout: 'vertical',
    align: 'right'

  },

See Fiddle here

Nishith Kant Chaturvedi
  • 4,719
  • 2
  • 16
  • 24